金额大写转换函数
来源:互联网 发布:淘宝网游账号交易 编辑:程序博客网 时间:2024/05/17 02:41
1//------------------转大写金额函数--------------------------------------------
2function NumToChnStr(Value: Real): String;
3const
4 ChnUnit: array[0..13] of string = ('分', '角', '元', '拾', '佰', '仟', '万', '拾', '佰', '仟', '亿', '拾', '佰', '仟');
5 ChnNum : array[0..9] of string = ('零', '壹','贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖');
6var
7 I: Integer;
8 StrValue, StrNum: String;
9 ValueLen: Integer;
10begin
11 try
12
13 StrValue := IntToStr(Round(Value * 100));
14 ValueLen := Length(StrValue);
15 Result := '';
16 for I := 1 to ValueLen do
17 begin
18 StrNum := StrValue[I];
19 Result := Result + ChnNum[StrToInt(StrNum)] + ChnUnit[ValueLen - I];
20 end;
21 Result := StringReplace(Result, '零角', '', [rfReplaceAll]);
22 Result := StringReplace(Result, '零分', '', [rfReplaceAll]);
23 Result := StringReplace(Result, '零拾', '零', [rfReplaceAll]);
24 Result := StringReplace(Result, '零佰', '零', [rfReplaceAll]);
25 Result := StringReplace(Result, '零仟', '零', [rfReplaceAll]);
26 Result := StringReplace(Result, '零万', '万', [rfReplaceAll]);
27 //Result := StringReplace(Result, '零元', '元', [rfReplaceAll]);
28 while pos('零零',Result)<>0 do
29 Result := StringReplace(Result, '零零', '零', [rfReplaceAll]);
30 if pos('零元',Result)<>0 then
31 Result := StringReplace(Result, '零元', '元', [rfReplaceAll]);
32 if pos('分',Result)=0 then
33 Result := Result+'整';
34 if (pos('分',Result)<>0) and (pos('角',Result)=0) then
35 Result := StringReplace(Result, '元', '元零', [rfReplaceAll]);
36 except
37 MessageDlg('转换出错!',mtInformation,[mbOK],0);
38 exit;
39 end;
40end;
2function NumToChnStr(Value: Real): String;
3const
4 ChnUnit: array[0..13] of string = ('分', '角', '元', '拾', '佰', '仟', '万', '拾', '佰', '仟', '亿', '拾', '佰', '仟');
5 ChnNum : array[0..9] of string = ('零', '壹','贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖');
6var
7 I: Integer;
8 StrValue, StrNum: String;
9 ValueLen: Integer;
10begin
11 try
12
13 StrValue := IntToStr(Round(Value * 100));
14 ValueLen := Length(StrValue);
15 Result := '';
16 for I := 1 to ValueLen do
17 begin
18 StrNum := StrValue[I];
19 Result := Result + ChnNum[StrToInt(StrNum)] + ChnUnit[ValueLen - I];
20 end;
21 Result := StringReplace(Result, '零角', '', [rfReplaceAll]);
22 Result := StringReplace(Result, '零分', '', [rfReplaceAll]);
23 Result := StringReplace(Result, '零拾', '零', [rfReplaceAll]);
24 Result := StringReplace(Result, '零佰', '零', [rfReplaceAll]);
25 Result := StringReplace(Result, '零仟', '零', [rfReplaceAll]);
26 Result := StringReplace(Result, '零万', '万', [rfReplaceAll]);
27 //Result := StringReplace(Result, '零元', '元', [rfReplaceAll]);
28 while pos('零零',Result)<>0 do
29 Result := StringReplace(Result, '零零', '零', [rfReplaceAll]);
30 if pos('零元',Result)<>0 then
31 Result := StringReplace(Result, '零元', '元', [rfReplaceAll]);
32 if pos('分',Result)=0 then
33 Result := Result+'整';
34 if (pos('分',Result)<>0) and (pos('角',Result)=0) then
35 Result := StringReplace(Result, '元', '元零', [rfReplaceAll]);
36 except
37 MessageDlg('转换出错!',mtInformation,[mbOK],0);
38 exit;
39 end;
40end;
- 金额大写转换函数
- 大写金额转换函数
- 发票大写金额转换函数
- TSQL 大写金额转换函数
- vb .net 转换大写金额函数
- 小写金额转换成大写金额的函数
- PHP 数字金额转换成中文大写金额的函数
- 金额大写转换
- 金额大写转换
- 金额的大写转换
- 金额大写转换
- 金额转换为大写
- 金额转换为大写
- 金额大写转换
- 金额转换成大写
- 金额转换大写
- 人民币大写金额转换
- 金额转换大写[java]
- 学习日记-序言
- 如何使用 .net 的TreeView控件
- c#中使用多线程
- Web开发中常见的安全缺陷及解决办法
- javasript的checkbox的一个问题
- 金额大写转换函数
- 2006-2-19(晴转多云)
- datagrid加checkbox实现分页不丢失选择的记录
- 在C#中实现行列转换
- Web 下配置文件信息的读写
- ASP.NET图片验证码控件
- 哥哥真的没来
- 加密网站配置文件中的信息
- 循序渐进学习 Ajax 的途径[收集]