|
- Public Function test(oldTXT As String) As String
- Dim newTXT As String
- Dim x As Integer, y As Integer
- x = Len(oldTXT)
- y = 1
- Do Until y > x
- If Mid(oldTXT, y, 1) Like "[a-z,0-9]" Then
- newTXT = newTXT & Mid(oldTXT, y, 1)
- y = y + 1
- If Mid(oldTXT, y, 1) Like "[a-z,0-9]" Then
- newTXT = newTXT & Mid(oldTXT, y, 1)
- y = y + 1
- If Mid(oldTXT, y, 1) Like "[a-z,0-9]" Then
- newTXT = newTXT & Mid(oldTXT, y, 1) & ""
- y = y + 1
- Else
- newTXT = newTXT & " "
- End If
- Else
- newTXT = newTXT & Mid(oldTXT, y, 1) & ""
- y = y + 1
- End If
- Else
- If Mid(oldTXT, y + 1, 1) Like "[a-z,0-9]" Then
- newTXT = newTXT & Mid(oldTXT, y, 2) & ""
- y = y + 2
- Else
- newTXT = newTXT & Mid(oldTXT, y, 1) & " "
- y = y + 1
- End If
- End If
- Loop
- test = newTXT
- End Function
复制代码
- ?test("11我a人2年吃了3斤油")
- 11 \我a\人2\年 \吃 \了3\斤 \油 \
- ?test("我a人2年吃了3斤油")
- 我a\人2\年 \吃 \了3\斤 \油 \
- ?test("1我a人2年吃了3斤油")
- 1我\a人\2年\吃 \了3\斤 \油 \
复制代码 |
|