Digital conversion to Chinese

zhaozj2021-02-11  230

Public Function chinanum (Byval Num As String) AS Stringon Error Goto chinanumerrchinanum = ""

DIM STR_TMP_CN AS STRINGDIM STR_TMP_ZS AS STRINGDIM STR_TMP_XS AS STRINGDIM I as Long

If VBA.TRIM (NUM) = "" "" "" ""

For i = 1 to vba.len (NUM) Step 1 Select Case VBA.MID $ (NUM, I, 1) Case "1", "2", "3", "4", "5", "6" , "7", "8", "9", "0", "." Case Else Goto chinanumerr End SelectNext i

If Num Like "*. *" Then if Num Like "*. *. *" Then Goto chinanumerr End if i = vba.instr (1, Num, ", vbtextCompare) STR_TMP_ZS = VBA.LEFT (Num, i - 1) STR_TMP_XS = VBA.right (NUM, VBA.LEN (NUM) - i)

STR_TMP_ZS = ZSTOSTR (STR_TMP_ZS) STR_TMP_XS = XSTOSTR (STR_TMP_XS) IF STR_TMP_ZS = "" "" "=" = "zero" ELSE STR_TMP_CN = STR_TMP_ZS END IF

IF str_tmp_xs <> "" "" THEN STR_TMP_CN = STR_TMP_CN & "Point" & STR_TMP_XS End IF

End ifgoto chinanumok

CHINANUMOK: if str_tmp_cn <> "" "" THENLET chinanum = str_tmp_cn else goto chinanumerr Endiff oto chinanumexit

Chinanumerr: err.clear chinanum = "" goto chinanumexit chinanumexit: 'CLEAR All Money Str_TMP_CN = "" str_tmp_zs = "" str_tmp_xs = "" i = 0 EXIT FUNCTION END FUNCTION

Private Function zsTOstr (ByVal str_ZS As String) As StringOn Error GoTo zsTOstrErr If Not IsNumeric (str_ZS) Or str_ZS Like "* *." Or str_ZS Like "* - *" Then If Trim (str_ZS) <> "" Then GoTo zsTOstrErr End If End If If VBA.Len (str_ZS)> 16 Then Let str_ZS = VBA.Left (str_ZS, 16) End If Dim intLen As Integer, intCounter As Integer Dim strCh As String, strTempCh As String Dim strSeqCh1 As String, strSeqCh2 As String DIM STR_ZS2CH AS STRING STR_ZS2CH = "Zero Zi Zi Wei Lu Lu" strSEQCH1 = "Pick up" strs = "STRSEQCH2 =" trillion "STR_ZS = CSTR (CDEC (STR_ZS)) INTLEN = LEN (STR_ZS) for intcounter = 1 to intlen startempch = mid (STR_ZS2CH, VAL (MID (Str_Zs, INTCUNTER, 1)) 1, 1) IF strtempch = "zero" and intlen <> 1 THEN IF MID (STR_ZS , IntCounter 1, 1) = "0" or (intlen - intcounter 1) MOD 4 = 1 dampch = "" END IF ELSE strTempCh = strTempCh & Trim (Mid (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 (STR_ZS, INTCOUNTER - 3, 4) = "0000" Then Strtempch = Left (Strtempch, Len (Strtempch) - 1) end if endiff = strch & trim Strtempch) Next Goto ZstoStrok

ZSTOSTROK: Let Zstostr = STRCH GOTO ZSTOSTREXITZSTOSTRERR: Err.clear Zstostr = "" Goto ZstostRexit

ZSTOSTREXIT: STRCH = "" Intlen = 0 intcounter = 0 strTempch = "" strSEQCH1 = "" str_zs2ch = "" "EXIT function

END FUNCTION

Private Function xsTOstr (ByVal str_XS As String) As StringOn Error GoTo xsTOstrErr If Not IsNumeric (str_XS) Or str_XS Like "* *." Or str_XS Like "* - *" Then If Trim (str_XS) <> "" Then GoTo xsTOstrErr End If End if if vba.len (STR_XS)> 20 THEN GOTO XSTOSTRERR END IF DIM STR_TH AS STRING STR_TH = "Zero Zibo" DIM I as Long Dim Str_TMP_XS AS STRING I = 1 to VBA. LEN (STR_XS) Step 1 STR_TMP_XS = STR_TMP_XS & VBA.MID (Str_th, VBA.cint (VBA.MID (Str_XS, I, 1)) 1, 1) Next I if Str_TMP_XS = "" THON XSTOSTRERR END IF GOTOSTOSTROK

XSTOSTROK: Let Xstostr = STR_TMP_XS GOTO XSTOSTREXIT

XSTOSTRERR: Err.clear Xstostr = "" Goto XstoStrexit

XSTOSTREXIT: STR_TH = "" i = 0 str_tmp_xs = "" EXIT FUNCTION

END FUNCTION

The above code from: SourceCode Explorer (source database) replication time: 2002-06-12 19:27:13 Current Version: 1.0.705 Author: Shawls profile: Http://Shawls.Yeah.Net E-Mail: ShawFile @ 163.net QQ: 9181729

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

New Post(0)