怎么把txt文档中的非中文全部替换成空字符串
怎么把txt文档中的非中文全部替换成空字符串
是不是ascii码大于零的都是非中文?我一个字符一个字符的判断,找到后怎么把这个字符替换成空字符或者删除呢???
Private Sub Command1_Click()
Dim iFileNumber As Integer
Dim strLineContent As String
Dim lngLineLength As Long
Dim strDest As String
Dim iCur As Long
iFileNumber = FreeFile
Open App.Path & "\strDemo.txt" For Input As #iFileNumber
While Not EOF(iFileNumber)
strLineContent = ""
strDest = ""
Line Input #iFileNumber, strLineContent
lngLineLength = Len(strLineContent)
For iCur = 1 To lngLineLength
If Asc(Mid$(strLineContent, iCur, 1)) < 0 Then
strDest = strDest & Mid$(strLineContent, iCur, 1)
End If
Next
Text1.Text = Text1.Text & strDest & vbCrLf
Wend
Close
End Sub