关于VB中的replace函数

2025-01-04 02:41:04
推荐回答(2个)
回答1:

建一个中间变量就可以了。
=================
Private Sub Command1_Click()
Dim t As String
t = Text1.Text
t = Replace(t, "a", "1")
t = Replace(t, "b", "2")
t = Replace(t, "c", "3")
Text2.Text = t
End Sub

回答2:

不需要用replace啊
dim a as string,b as string,i as integer
for i=1 to len(text1.text) step 1
a=mid(text1.text,i,1)
select case a
case "a"
a=1
case "b"
a=2
case "c"
a=3
end select
b=b & a
next i
text2.text=b