zoukankan      html  css  js  c++  java
  • 提取字符串中的数字

    CREATE DEFINER=`root`@`localhost` FUNCTION `getNum`(Varstring varchar(50)) RETURNS varchar(30) CHARSET utf8
    BEGIN
    DECLARE v_length INT DEFAULT 0;
    DECLARE v_Tmp varchar(50) default '';
    DECLARE s_len INT DEFAULT 0;
    DECLARE e_len INT DEFAULT 0;
    
    set v_length=CHAR_LENGTH(Varstring);
    
    set s_len = v_length - 5;
    set Varstring = right(Varstring,s_len);
    set v_length=CHAR_LENGTH(Varstring);
    set e_len = v_length - 18;
    
    set Varstring = left(Varstring,e_len);
    
    WHILE v_length > 0 DO
    IF (ASCII(mid(Varstring,v_length,1))>47 and ASCII(mid(Varstring,v_length,1))<58 or ASCII(mid(Varstring,v_length,1))=46 or mid(Varstring,v_length,1)='万')   THEN
    set v_Tmp=concat(v_Tmp,mid(Varstring,v_length,1));
    END IF;
    SET v_length = v_length - 1;
    END WHILE;
    RETURN REVERSE(v_Tmp);
    END
  • 相关阅读:
    最小生成树算法
    并查集
    背包问题
    木桶排序
    STL之vector
    STL中的queue用法与stack用法对比
    快速幂求模
    归并排序+典型例题(逆序对)
    负进制转换
    冒泡排序
  • 原文地址:https://www.cnblogs.com/beibidewomen/p/10161041.html
Copyright © 2011-2022 走看看