码迷,mamicode.com
首页 > Windows程序 > 详细

delphi 提取字符中的数字

时间:2016-04-24 21:53:23      阅读:345      评论:0      收藏:0      [点我收藏+]

标签:

Function Setstring(cString:string):string;   {提取数字}
 VAr
   i:integer;
   str:string;
  begin
    str:=‘‘;
      For i:=1 to length(cString) do
          begin
           if Pos(cString[i],‘0123456789.‘)<=0 then
             break
           else
            Case cString[i] of
             ‘.‘: str:=Str+‘.‘; 

             ‘0‘: str:=Str+‘0‘;   ‘1‘: str:=Str+‘1‘; ‘2‘: str:=Str+‘2‘;
             ‘3‘: str:=Str+‘3‘;   ‘4‘: str:=Str+‘4‘; ‘5‘: str:=Str+‘5‘;
             ‘6‘: str:=Str+‘6‘;   ‘7‘: str:=Str+‘7‘;
             ‘8‘: str:=Str+‘8‘;   ‘9‘: str:=Str+‘9‘;
            end;
    end;
    Setstring:=str;
  end;
 
如121545ADFDF.121 提取之后是 121545 函数中去掉break命令部份,结果便是:121545.121 

delphi 提取字符中的数字

标签:

原文地址:http://www.cnblogs.com/hssbsw/p/5428198.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!