思路:
1.将文本框1的内容,读入到变量LinStr
2.将变量LinStr的值,分成若干个单个数字的值,存入数组变量D,去掉重复的不输入.
3.按照你的要求的规则,转换成字符串Ls
4.将Ls显示在文本框2
代码如下:
Private Sub Command1_Click()
Dim LinStr As String
Dim Ls As String
Dim L As Integer
Dim i As Integer
Dim d() As String
Dim n As Integer
Dim YesNo As Boolean
Dim j As Integer
LinStr = Text1.Text
L = Len(LinStr)
n = 0
For i = 1 To L
YesNo = False
For j = 1 To n
If d(j) = Mid(LinStr,i,1) Then
YesNo = True
Exit For
End If
Next j
If Not YesNo Then
n = n + 1
ReDim Preserve d(1 To n) As String
d(n) = Mid(LinStr,i,1)
End If
Next i
Ls = ""
For i = 1 To n
Select Case d(i)
Case "1"
Ls = Ls & "38"
Case "3"
Ls = Ls & "49"
Case "5"
Ls = Ls & "05"
Case "7"
Ls = Ls & "16"
Case "9"
Ls = Ls & "27"
End Select
Next i
Text2.Text = Ls
End Su