Converts the lower case of a currency to an upper case.

Source: Internet
Author: User

'Convert the lower-case currency into upper-case currencies. For example, the shard points in the round

Public Function num2chi (byval txtje as double) as string

Dim I, K as integer

Dim NC, Nd, ka, chrnum, strzheng as string

Dim C1, C2, C3 as string

Dim K1 as integer

Dim Zheng as string

Dim Xiao as string

NC = trim (format (txtje, "#0.00 "))

C1 = "collect tens of thousands of yuan, collect hundreds of millions of yuan, and collect tens of thousands of yuan"

C2 = "Angular score"

C3 = "Lu Wusi Yu eryi"

If NC = 0 then

Num2chi = "Zero RMB"

Exit Function

End if

Num2chi = ""

Zheng = mid (NC, 1, (LEN (NC)-3 ))

Xiao = mid (NC, (LEN (Zheng) + 2 ))

If Val (Xiao) <> 0 then

For I = Len (Xiao) to 1 step-1

Chrnum = mid (Xiao, I, 1)

If chrnum <> 0 then

Num2chi = mid (C2, I, 1) & num2chi

Num2chi = mid (C3, (LEN (C3)-chrnum + 1), 1) & num2chi

End if

Next I

End if

 

K = 0

If Val (Zheng) <> 0 then

Num2chi = "Yuan" & num2chi

For I = Len (Zheng) to 1 step-1

If (LEN (Zheng)-I) = 4 then

Num2chi = "Ten Thousand" & num2chi

Elseif (LEN (Zheng)-I) = 8 then

Num2chi = "" & num2chi

Elseif (LEN (Zheng)-I) = 12 then

Num2chi = "Ten Thousand" & num2chi

End if

Chrnum = mid (Zheng, I, 1)

If chrnum <> 0 then

If I = Len (Zheng) then

Num2chi = mid (C3, (LEN (C3)-chrnum + 1), 1) & num2chi

Else

If (LEN (Zheng)-I) <> 4 and (LEN (Zheng)-I) <> 8 and (LEN (Zheng)-I) <> 12 then

Num2chi = mid (C1, (LEN (C1)-K), 1) & num2chi

End if

Num2chi = mid (C3, (LEN (C3)-chrnum + 1), 1) & num2chi

End if

Else

If mid (num2chi, 1, 1) <> "Yuan" and mid (num2chi, 1, 1) <> "Ten Thousand" and mid (num2chi, 1, 1) <> "billion" then

If mid (num2chi, 1, 1) <> "zero" then

Num2chi = "0" & num2chi

End if

End if

End if

K = k + 1

Next I

End if

If right (TRIM (num2chi), 1) <> "points" then

Num2chi = num2chi & "integer"

End if

End Function

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.