具有值“"的字符串声明"结果 [英] string declaration with value having " " in result
本文介绍了具有值“"的字符串声明"结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
我需要声明一个字符串变量并分配一个字符串值,这样结果将具有".我的意思是
Hello,
I need to declare a string variable and assign a string value such that the result will have "" . I mean ,
dim str as string
str = " "some value" "
因此,当我打印str时,它应该打印带有引号的某些值".
我需要VB.Net中的语法.
谢谢.
so when I print str, it should print "some value" ..with quotes.
I need the syntax for this in VB.Net.
Thanks.
推荐答案
尝试:
Dim str As String = " ""somevalue"" "
[edit]将空格放在错误的位置:
[edit]Got the spaces in the wrong place:
""" somevalue """
已更改为
" ""somevalue"" "
-OriginalGriff [/edit]
- OriginalGriff[/edit]
在 VB.Ne 中,您可以通过使用 4个双引号("")来指示字符串中有双引号.
In VB.Net you can indicate that there is a double quote in a string by using 4 double quotes ("""").
Dim str As String = "Example String " & """" & "This is the String with double quotes." & """"
MessageBox.Show(str)
另请参阅:
如何打印VB.NET中单引号和双引号的字符串 [
Also refer:
How to print a string in single and double Quotes in VB.NET[^]
This article gives you details of how to print a string in single Quotation and double Quotation Mark in VB.NET.
这篇关于具有值“"的字符串声明"结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文