1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 计算机vb里代码里的双引号 在VB中使用字符串中的左双引号

计算机vb里代码里的双引号 在VB中使用字符串中的左双引号

时间:2022-09-12 20:52:05

相关推荐

计算机vb里代码里的双引号 在VB中使用字符串中的左双引号

看起来就像您在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)

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。