Turn arabic to the Chinese word

zhaozj2021-02-17  52

Private function cchinese (Streng as string) AS String

IF not isnumeric (streng) or strengten "*. *" Or streng limited "* - *" THEN

IF Trim (Streng) <> "" THEN MSGBOX "invalid number"

Cchinese = "": exit function

END IF

DIM INTLEN AS INTEGER, INTCOUNTER AS INTEGER

DIM STRCH AS STRING, STRTEMPCH AS STRING

DIM STRSEQCH1 AS STRING, STRSEQCH2 AS STRING

Dim Streng2ch as String

STRENG2CH = "Zero Zibo 叁 伍 柒捌"

STRSEQCH1 = "Pick up 仟 佰 仟 仟 仟 仟"

STRSEQCH2 = "trillion"

Streng = CSTR (CDEC (Streng))

Intlen = len (streng)

For intcounter = 1 to intlen

Strtempch = MID (Streng2ch, Val (STRENG, INTCOUNTER, 1)) 1, 1)

If stratempch = "zero" and intlen <> 1

IF MID (Streng, Intcounter 1, 1) = "0" or (intlen - Intcounter 1) mod 4 = 1 THEN

Strtempch = ""

END IF

Else

Strtempch = Strtempch & Trim (STRSEQCH1, INTLEN - INTCOUNTER 1, 1))

END IF

IF (intlen - intcounter 1) mod 4 = 1 THEN

Strtempch = Strtempch & Mid (StrseqCH2, (Intlen - IntCounter 1) / 4 1, 1)

IF IntCounter> 3 THEN

IF MID (Streng, Intcounter - 3, 4) = "0000" Then Strtempch = Left (Strtempch, Len (STRTEMPCH) - 1)

END IF

END IF

StrCh = strch & trim (strtempch)

NEXT

CCHINESE = STRCH

END FUNCTION

转载请注明原文地址:https://www.9cbs.com/read-29650.html

New Post(0)