type
TChnnum=record
rate:integer;
str:string;
end;
const chndigit:array[0..9]of Char=('零','一','二','三','四','五','六','七','八','九');
function ChnToNum (s:string):Integer;
var chnnums:array[0..3] of TChnnum ;
i,j:integer;
a,b,x:integer;
str:string ;
begin
chnnums[0].rate:=10;chnnums[0].str:='十';
chnnums[1].rate:=100;chnnums[1].str:='百';
chnnums[2].rate:=1000;chnnums[2].str:='千';
chnnums[3].rate:=10000;chnnums[3].str:='万';
//从左开始对字
str:=s;
x:=0;
i:=0;
if str[1] ='十' then begin
x:=10;
inc(i);
end;
while i<s.Length do
begin
a:=0;b:=1;
inc(i);
for j:=Low(chndigit) to High(chndigit) do
if str[i] =chndigit[j] then begin
if j=0 then inc(i)
else begin
a:=j;
break;
end;
end ;
if (a=0 ) and (i=1) then a:=1;
if i< s.Length then begin
inc(i);
for j:= Low(chnnums) to High(chnnums) do
if str[i]= chnnums[j].str then begin
b:= chnnums[j].rate;
break;
end;
end;
x:=x+a*b;
end;
Result:=x;
end;