|
- Private Function enTozhMark(ReplaceStr As String) As String
- '把传递进来的字符串中的英文标点符号替换成中文标点符号
- '作者:咱家是猫 QQ:130036500
- Const enStr As String = ",.?;:!()"
- Const zhStr As String = ",。?;:!()"
- Dim I As Byte, L As Integer, B As Boolean, N As Integer
-
- enTozhMark = ReplaceStr
- '替换常规标点符号
- For I = 1 To 8
- enTozhMark = Replace(enTozhMark, Mid(enStr, I, 1), Mid(zhStr, I, 1))
- Next I
- L = Len(enTozhMark)
- '替换双引号
- N = 0: B = False
- For I = 1 To L
- N = InStr(N + 1, enTozhMark, Chr(34))
- If N <> 0 Then
- I = N
- If B = False Then
- enTozhMark = Left(enTozhMark, N - 1) & "“" & Mid(enTozhMark, N + 1)
- Else
- enTozhMark = Left(enTozhMark, N - 1) & "”" & Mid(enTozhMark, N + 1)
- End If
- B = Not B
- Else
- Exit For
- End If
- Next I
- '替换单引号
- N = 0: B = False
- For I = 1 To L
- N = InStr(N + 1, enTozhMark, Chr(39))
- If N <> 0 Then
- I = N
- If B = False Then
- enTozhMark = Left(enTozhMark, N - 1) & "‘" & Mid(enTozhMark, N + 1)
- Else
- enTozhMark = Left(enTozhMark, N - 1) & "’" & Mid(enTozhMark, N + 1)
- End If
- B = Not B
- Else
- Exit For
- End If
- Next I
-
- End Function
复制代码 |
|