function D_Chinese(str:string):string;
var
s : string;
begin
//〇,一,二
if str='0' then s :='〇'
else if str='1' then s :='一'
else if str='2' then s :='二'
else if str='3' then s :='三'
else if str='4' then s :='四'
else if str='5' then s :='五'
else if str='6' then s :='六'
else if str='7' then s :='七'
else if str='8' then s :='八'
else if str='9' then s :='九'
else
s:=s;
Result := s;
end;function Time_Change(tm : string):string;//日期转换
var
m,mm:string;
i,lg:integer;
begin
mm:='';
lg:=length(tm);
for i:=0 to lg-1 do
begin
m:=D_Chinese(Copy(tm,i,i));
mm:=mm+m;
end;
mm:=mm;
Result :=mm;end;
var
s : string;
begin
//〇,一,二
if str='0' then s :='〇'
else if str='1' then s :='一'
else if str='2' then s :='二'
else if str='3' then s :='三'
else if str='4' then s :='四'
else if str='5' then s :='五'
else if str='6' then s :='六'
else if str='7' then s :='七'
else if str='8' then s :='八'
else if str='9' then s :='九'
else
s:=s;
Result := s;
end;function Time_Change(tm : string):string;//日期转换
var
m,mm:string;
i,lg:integer;
begin
mm:='';
lg:=length(tm);
for i:=0 to lg-1 do
begin
m:=D_Chinese(Copy(tm,i,i));
mm:=mm+m;
end;
mm:=mm;
Result :=mm;end;
解决方案 »
- 求助
- 有点小难度(高分相送)
- 请问在一个工程button中怎么调用另工程
- 学DELPHI的数据库开发.要很精通Object Pascal吗?
- 珍藏——身份证号认证算法。(根据国家GB 11643-1999标准。up 有分)
- delphi中的资源文件用什么工具编辑比较好?我的资源文件比较大
- 请问有广东省佛山的程序员吗?
- BDE里面的密码问题
- 在Delphi中编辑的blob插不到unix服务器中的oracle8i?
- 我的程序里面调用了我自己编写的dll。在其他机器上运行是没有办法调用自己编写的dll
- 校验图随机生成图编写成DLL文件主程序中加载这个DLL但是老是不定时的出错
- 用GetProp函数如何获取一控件的过程或者函数地址。
http://topic.csdn.net/u/20101011/10/87aba92a-0a7f-4c0e-92f9-13cbd57aeed8.html
var
s : string;
begin
//〇,一,二
if str='0' then s :='〇'
else if str='1' then s :='一'
else if str='2' then s :='二'
else if str='3' then s :='三'
else if str='4' then s :='四'
else if str='5' then s :='五'
else if str='6' then s :='六'
else if str='7' then s :='七'
else if str='8' then s :='八'
else if str='9' then s :='九'
else
s:=s; // 改为s := str;
Result := s;
end;function Time_Change(tm : string):string;//日期转换
var
m,mm:string;
i,lg:integer;
begin
mm:='';
lg:=length(tm);
for i:=0 to lg-1 do
begin
m:=D_Chinese(Copy(tm,i,i)); //m:=D_Chinese(Copy(tm,i,1));
mm:=mm+m;
end;
mm:=mm; //可以不用写
Result :=mm;end;
2. 日期转换函数里 m:=D_Chinese(Copy(tm,i,i)); COPY的最后的参数应该是1,改为 m:=D_Chinese(Copy(tm,i,1));
同3楼,string类型是可以直接使用下标进行访问的,string下标从1开始。for i:= 1 to lg do
begin
m := D_Chinese(tm[i]);
mm:= mm+m;
end;
3. 楼主,要养成自己检查错误的习惯,有什么错的地方,可以跟踪一下代码看看,然后仔细得看看你的代码的每个字符是不是你想要的。