近乎弱智的代码
Private Sub Command1_Click()
Text2.Text = Text1.Text
Text2.Text = Replace(Text2.Text, "<", "↓")
Text2.Text = Replace(Text2.Text, ">", "↑")
Text2.Text = Replace(Text2.Text, "-", "→")
Text2.Text = Replace(Text2.Text, "deg", "℃")
Dim str As String
str = ""
'-------------
If Check1.Value = 1 Then
For i = 1 To Len(Text2.Text)
b = Asc(Mid(Text2.Text, i, 1))
If i = 1 Then
str = str + Chr(b)
Else
c = Asc(Mid(Text2.Text, i - 1, 1))
If b >= 48 And b <= 57 And ((c > 97 And c < 122) Or (c > 65 And c < 90)) Then
str = str + "[" + Chr(b) + "]"
Else
str = str + Chr(b)
End If
End If
Next
Text2.Text = str
End If
'-------------
Text2.Text = Replace(Text2.Text, "[", "")
Text2.Text = Replace(Text2.Text, "]", "")
Text2.Text = Replace(Text2.Text, "{", "")
Text2.Text = Replace(Text2.Text, "}", "")
Text2.Text = Replace(Text2.Text, "<", "[")
Text2.Text = Replace(Text2.Text, ">", "]")
Text2.SetFocus
End Sub
Private Sub Command2_Click()
Form2.Show
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then Command1_Click
End Sub
Private Sub Text2_gotfocus()
Text2.SelStart = 0
Text2.SelLength = Len(Text2.Text)
End Sub
Text2.Text = Text1.Text
Text2.Text = Replace(Text2.Text, "<", "↓")
Text2.Text = Replace(Text2.Text, ">", "↑")
Text2.Text = Replace(Text2.Text, "-", "→")
Text2.Text = Replace(Text2.Text, "deg", "℃")
Dim str As String
str = ""
'-------------
If Check1.Value = 1 Then
For i = 1 To Len(Text2.Text)
b = Asc(Mid(Text2.Text, i, 1))
If i = 1 Then
str = str + Chr(b)
Else
c = Asc(Mid(Text2.Text, i - 1, 1))
If b >= 48 And b <= 57 And ((c > 97 And c < 122) Or (c > 65 And c < 90)) Then
str = str + "[" + Chr(b) + "]"
Else
str = str + Chr(b)
End If
End If
Next
Text2.Text = str
End If
'-------------
Text2.Text = Replace(Text2.Text, "[", "")
Text2.Text = Replace(Text2.Text, "]", "")
Text2.Text = Replace(Text2.Text, "{", "")
Text2.Text = Replace(Text2.Text, "}", "")
Text2.Text = Replace(Text2.Text, "<", "[")
Text2.Text = Replace(Text2.Text, ">", "]")
Text2.SetFocus
End Sub
Private Sub Command2_Click()
Form2.Show
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then Command1_Click
End Sub
Private Sub Text2_gotfocus()
Text2.SelStart = 0
Text2.SelLength = Len(Text2.Text)
End Sub