读书人

VB 字符替换有关问题

发布时间: 2012-02-16 21:30:36 作者: rapoo

VB 字符替换问题
建立 text1 text2

如 text1.text= "ABCD "


A替换为01
B替换为02
C替换为03
D替换为04

显示到 text2.text= "01020304 "

这个替换过程要如何实现?

请给出具体例子代码



[解决办法]
Dim i As Integer, strTmp As String, j As Integer
j = 1
For i = 65 To 90
strTmp = strTmp & Format(j, "00 ")
j = j + 1
Next
MsgBox Len(strTmp)
[解决办法]
dim s as string
text1.text= "ABCD "
s=text1.text
text2.text=Replace(Replace(Replace(Replace(s, "A ", "01 "), "B ", "02 "), "C ", "03 "), "D ", "04 ")

读书人网 >VB

热点推荐