看起来就像您在Microsoft.VisualBasic命名空间中搜索ChrW function一样,该命名空间用于将Unicode字符代码转换为实际字符。 强>
如果您尝试用带引号的引号替换字符串中的直引号,请尝试以下代码:
'Declare a string that uses straight quotes
Dim origString As String = "This string uses ""quotes"" around a word."
'Create a new string by replacing the straight quotes from the original string
'with left-facing curly quotes
Dim newString As String = origString.Replace("""", ChrW(8220))
'Display the result
MessageBox.Show(newString)
或者,如果您尝试使用备用表示法替换它们来编码字符串中的左侧卷曲引号(假设您在问题中使用的那个是正确的),请尝试以下代码:
'Declare a string that uses left-facing curly quotes
Dim origString As String = "This string uses fancy " & ChrW(8220) & _
"quotes" & ChrW(8220) & " around a word."
'Create a new string by replacing the curly quotes with an arbitrary string
Dim newString As String = origString.Replace(ChrW(8220), "“")
'Display the result
MessageBox.Show(newString)