zoukankan      html  css  js  c++  java
  • 水晶報表:金額轉換大寫12/8

    Visual Basic語法:
    dim sa,sb,sc as string
    sa=cstr({命令.amt})
    sa=replace(sa,",","")

    dim i,j,p as  Number
    i=1
    j=len(sa)
    sb=""

    p=InStrRev (sa,"." )
    if right(sa,3)=".00" then
    j=j-2
    elseif right(sa,1)="0" then
    j=j-1
    end if

    do while i<j+1
       sc=mid(sa,i,1)
    select case sc
    case "0"
    sb=sb+"零"
    case "1"
    sb=sb+"壹"
    case "2"
    sb=sb+"貳"
    case "3"
    sb=sb+"叁"
    case "4"
    sb=sb+"肆"
    case "5"
    sb=sb+"伍"
    case "6"
    sb=sb+"陸"
    case "7"
    sb=sb+"柒"
    case "8"
    sb=sb+"捌"
    case "9"
    sb=sb+"玖"
    case else
    sb=sb+"元"
    end select
    if i=p+1 then
       sb=sb+"角"
    elseif i=p+2 then
       sb=sb+"分"
    end if

    select case p-i
    case 9
    if right(sb,1)<>"零" then sb=sb+"億"
    case 8
    if right(sb,1)<>"零" then sb=sb+"仟"
    case 7
    if right(sb,1)<>"零" then sb=sb+"百"
    case 6
    if right(sb,1)<>"零" then sb=sb+"拾"
    case 5
    if right(sb,1)<>"零" then sb=sb+"萬"
    case 4
    if right(sb,1)<>"零" then sb=sb+"仟"
    case 3
    if right(sb,1)<>"零" then sb=sb+"百"
    case 2
    if right(sb,1)<>"零" then sb=sb+"拾"
    case else
    end select

    i=i+1
    loop
    if right(sa,3)=".00" then sb=sb+"整"
    sb=replace(sb,"零零","")
    sb=replace(sb,"零元","元")
    formula =sb

  • 相关阅读:
    写在noi之前
    雅礼集训 Day8
    雅礼集训 Day6
    雅礼集训 Day5
    2017雅礼集训 Day4
    2017雅礼集训 Day2
    2017雅礼集训 Day1
    洛谷 P3426 [POI2005]SZA-Template
    Codeforces Round #368 DIV2 C.
    Educational Codeforces Round 16 D&E.
  • 原文地址:https://www.cnblogs.com/daisylh/p/987725.html
Copyright © 2011-2022 走看看