是纯中文数字?只为100以下的做过:(里面如果有万、千、百,就不灵了)<br><br>function ConvertChineseToNumber(const s:string):integer;<br>var<br> i,theLength:integer;<br> num,PartOfS:string;<br>Begin<br> theLength := Length(s);<br> num := '';<br><br> if(thelength = 1) then num := '0';<br><br> i := 1;<br> if(s = '十') then<br> begin<br> Result := 10;<br> exit;<br> end;<br><br> PartOfS := Copy(s,i,2);<br> if(PartOfS = '十') then<br> Begin<br> num := num + '1';<br> Inc(i,2);<br> end;<br><br> while(i < theLength) do<br> Begin<br> PartOfS := Copy(s,i,2);<br> if((PartOfS = '零') or (PartOfS = '0') or (PartOfS = '○')) then<br> Begin<br> num := num + '0';<br> Inc(i,2);<br> continue;<br> end<br> else if(PartOfS = '十') then<br> begin<br> Inc(i,2);<br> if(i = thelength - 1) then num := num + '0';<br> continue;<br> end<br> else if((PartOfS = '一') or (PartOfS = '1')) then<br> Begin<br> num := num + '1';<br> Inc(i,2);<br> continue;<br> end<br> else if((PartOfS = '二') or (PartOfS = '2') or (PartOfS = '廿')) then<br> Begin<br> num := num + '2';<br> Inc(i,2);<br> continue;<br> end<br> else if((PartOfS = '三') or (PartOfS = '3') or (PartOfS = '叁') or (PartOfS = '卅')) then<br> Begin<br> num := num + '3';<br> Inc(i,2);<br> continue;<br> end<br> else if((PartOfS = '四') or (PartOfS = '4')) then<br> Begin<br> num := num + '4';<br> Inc(i,2);<br> continue;<br> end<br> else if((PartOfS = '五') or (PartOfS = '5')) then<br> Begin<br> num := num + '5';<br> Inc(i,2);<br> continue;<br> end<br> else if((PartOfS = '六') or (PartOfS = '6')) then<br> Begin<br> num := num + '6';<br> Inc(i,2);<br> continue;<br> end<br> else if((PartOfS = '七') or (PartOfS = '7')) then<br> Begin<br> num := num + '7';<br> Inc(i,2);<br> continue;<br> end<br> else if((PartOfS = '八') or (PartOfS = '8')) then<br> Begin<br> num := num + '8';<br> Inc(i,2);<br> continue;<br> end<br> else if((PartOfS = '九') or (PartOfS = '9')) then<br> Begin<br> num := num + '9';<br> Inc(i,2);<br> continue;<br> end<br> else<br> Begin<br> Inc(i);<br> continue;<br> end;<br> end;<br><br> if Length(num) = 0 then Result := 0<br> else Result := StrToInt(num);<br>end;<br><br>