mysql 函数
DELIMITER $$
USE `teacherplatfrom`$$
DROP FUNCTION IF EXISTS `func_split`$$
CREATE DEFINER=`payu`@`%` FUNCTION `func_split`(f_string VARCHAR(1000),f_delimiter VARCHAR(5),i INT) RETURNS VARCHAR(255) CHARSET utf8
BEGIN
DECLARE result VARCHAR(255) DEFAULT '';
# 获取前 i 个字符串反转再获取第一个字符串再反转
SET result = REVERSE(SUBSTRING_INDEX(REVERSE(SUBSTRING_INDEX(f_string,f_delimiter,i)),f_delimiter,1));
RETURN result;
END$$
DELIMITER ;
DELIMITER $$
USE `teacherplatfrom`$$
DROP FUNCTION IF EXISTS `func_split_TotalLength`$$
CREATE DEFINER=`payu`@`%` FUNCTION `func_split_TotalLength`(f_string VARCHAR(1000),f_delimiter VARCHAR(5)) RETURNS INT(11)
BEGIN
RETURN 1+(LENGTH(f_string) - LENGTH(REPLACE(f_string,f_delimiter,'')));
END$$
DELIMITER ;