我看到這個問題很久以前就問過了,我想你現在已經找到了答案。無論如何,這正是我目前所做的。我尋找要替換的特定字符,並在另一個陣列中放入我希望它們更改的字符。我希望這對你有用。
Private Function CleanText(TextToClean As String) As String
Dim CleanedText As String = TextToClean
Dim BadText(5) As Char
Dim GoodText(5) As String
BadText(0) = ChrW(169) ' © (alt 0169, copyright)
BadText(1) = ChrW(174) ' ® (alt 0174, registered trademark)
BadText(2) = ChrW(8482) ' ™ (alt 0153, trademark)
BadText(3) = ChrW(8364) ' € (alt 0128, Euro)
BadText(4) = ChrW(176) ' ° (alt 0176, degrees)
GoodText(0) = "(c)"
GoodText(1) = "(r)"
GoodText(2) = "(tm)"
GoodText(3) = "(euro)"
GoodText(4) = "o"
For i As Integer = 0 To BadText.GetUpperBound(0)
CleanedText = CleanedText.Replace(BadText(i), GoodText(i))
Next
Return CleanedText
End Function