求把整型变量转化成字符串的代码?在线等!

xiaoche79 2005-11-26 06:36:43
给你一个整型变量,要求把它编程和它一致的中文大写字符串??
如23456转化成"贰叁肆伍陆"
...全文
194 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
northwolves 2005-11-26
  • 打赏
  • 举报
回复
or:

Private Sub Command1_Click()
shownum "0123456789"
End Sub

Sub shownum(ByVal num As String)
num = "I" & num & " "
Text1.Text = ""
Text1.IMEMode = 1
Text1.SetFocus
SendKeys num
End Sub
northwolves 2005-11-26
  • 打赏
  • 举报
回复
设置智能ABC为默认输入法:

Private Sub Command1_Click()
shownum "01234567890"
End Sub

Sub shownum(ByVal num As String)
Text1.Text = ""
Text1.IMEMode = 1
Text1.SetFocus
SendKeys "I" & num
SendKeys " "
End Sub
rainstormmaster 2005-11-26
  • 打赏
  • 举报
回复
Private Function test(ByVal n As Long) As String
Dim s As String
s = "零壹贰叁肆伍陆柒八九"
Dim tmp As String, t As String
tmp = CStr(n)
Dim i As Long
For i = 0 To 9
tmp = Replace(tmp, CStr(i), Mid(s, i + 1, 1))
Next
test = tmp
End Function

Private Sub Command1_Click()
MsgBox test(34901)
End Sub
faysky2 2005-11-26
  • 打赏
  • 举报
回复
Private Function cNumToStr(ByVal pStr As Long) As String
Dim strTemp As String * 1, i%, strResult As String, strCmp As String

strCmp = "壹贰叁肆伍陆柒八九"
For i = 1 To Len(CStr(pStr))
strTemp = Mid(CStr(pStr), i, 1)
strResult = strResult & Mid(strCmp, strTemp, 1)
Next
Debug.Print strResult
End Function
'调用
Private Sub Command1_Click()
Dim strRet As String
strRet = cNumToStr(23456)
Debug.Print strRet
End Sub
faysky2 2005-11-26
  • 打赏
  • 举报
回复

Private Sub Command1_Click()
Dim strTemp As String * 1, i%, x As String, strResult As String, strCmp As String
x = "1234589"
strCmp = "贰叁肆伍陆柒八九"
For i = 1 To Len(x)
strTemp = Mid(x, i, 1)
strResult = strResult & Mid(strCmp, strTemp, 1)
Next
Debug.Print strResult
End Sub
winehero 2005-11-26
  • 打赏
  • 举报
回复
写代码,Select Case就行,这还发帖子?!

7,762

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧