记号

stringvar NumberStr:="$1000.26";//传入数据必须2位小数,是0=0.00的格式 //去掉,的字符 Global Stringvar CancelNumberStr:=Replace(NumberStr,",",""); //去掉&号 CancelNumberStr:=Replace(CancelNumberStr,"$",""); //整数 stringvar IntNumberStr:=Left(CancelNumberStr, InStr (CancelNumberStr, ".")-1); //小数 StringVar DecNumber := Right (CancelNumberStr, Length (CancelNumberStr) - InStr (CancelNumberStr, ".")); DecNumber :=Mid(DecNumber,1,2); stringVar intResult;//整数部分的金额数据字符 if tonumber(IntNumberStr)<>0 then ( //整数捕部分大写数组 stringVar Array IntUpperStr; numberVar i; Redim IntUpperStr[length(IntNumberStr)]; For i := 1 To length(IntNumberStr) Do ( If Mid(IntNumberStr,i,1)="0" Then IntUpperStr[i]:="零" Else If Mid(IntNumberStr,i,1)="1" Then IntUpperStr[i]:="壹" Else If Mid(IntNumberStr,i,1)="2" Then IntUpperStr[i]:="贰" Else If Mid(IntNumberStr,i,1)="3" then IntUpperStr[i]:="叁" Else If Mid(IntNumberStr,i,1)="4" then IntUpperStr[i]:="肆" Else If Mid(IntNumberStr,i,1)="5" then IntUpperStr[i]:="伍" Else If Mid(IntNumberStr,i,1)="6" then IntUpperStr[i]:="陆" Else If Mid(IntNumberStr,i,1)="7" then IntUpperStr[i]:="柒" Else If Mid(IntNumberStr,i,1)="8" then IntUpperStr[i]:="捌" Else If Mid(IntNumberStr,i,1)="9" then IntUpperStr[i]:="玖" ); StringVar Array intDotUnit; intDotUnit := ["元","拾","佰","仟","萬","拾","佰","仟","億","拾","佰","仟","万","拾","佰","仟"]; // 在大寫金額數字中加入單位 (整數位) intResult:=""; Local NumberVar j; Local NumberVar k := 1; For j := length(IntNumberStr) To 1 Step -1 Do ( If (IntUpperStr[j]="零" and intDotUnit[k] = "元") then intResult := intDotUnit[k]+intResult Else If (IntUpperStr[j]="零" and intDotUnit[k]<> "元") then intResult := IntUpperStr[j]+intResult Else intResult := IntUpperStr[j]+intDotUnit[k]+intResult; k:=k+1; ); //去掉"零零"换 intResult:=Replace(intResult,"零零","零"); ) else intResult:=""; //处理小数大写 stringvar Array DecUpperStr; Redim DecUpperStr[2]; For i := 1 To 2 Do ( If Mid(DecNumber,i,1)="0" Then DecUpperStr[i]:="零" Else If Mid(DecNumber,i,1)="1" Then DecUpperStr[i]:="壹" Else If Mid(DecNumber,i,1)="2" Then DecUpperStr[i]:="贰" Else If Mid(DecNumber,i,1)="3" then DecUpperStr[i]:="叁" Else If Mid(DecNumber,i,1)="4" then DecUpperStr[i]:="肆" Else If Mid(DecNumber,i,1)="5" then DecUpperStr[i]:="伍" Else If Mid(DecNumber,i,1)="6" then DecUpperStr[i]:="陆" Else If Mid(DecNumber,i,1)="7" then DecUpperStr[i]:="柒" Else If Mid(DecNumber,i,1)="8" then DecUpperStr[i]:="捌" Else If Mid(DecNumber,i,1)="9" then DecUpperStr[i]:="玖" ); //处理角的时候 if DecUpperStr[1]="零" then DecUpperStr[1]:=DecUpperStr[1] else DecUpperStr[1]:=DecUpperStr[1]+"角"; //处理分的时候 if DecUpperStr[2]="零" then DecUpperStr[2]:= DecUpperStr[2] else DecUpperStr[2]:=DecUpperStr[2]+"分"; //小数部分n角n分 stringvar DecResult; DecResult:=DecUpperStr[1]+DecUpperStr[2]; if DecResult="零零" then DecResult:="" else if DecUpperStr[1]<>"零" and DecUpperStr[2]="零" then DecResult:=DecUpperStr[1] else if DecUpperStr[1]="零" and DecUpperStr[2]<>"零" then DecResult:=DecUpperStr[2]; //去掉"零零"换 numbervar Zi; For Zi:=1 To Length(intResult) Do ( intResult:=Replace(intResult,"零零","零") ); //输出结果 if(intResult="" and DecResult="") then totext("零元") else totext(intResult+DecResult+"整");
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值