In C# you can use \\ to ignore the special characters:
string myString = "this is a \" string";
that would work as one complete string... in VB, doing that does not work...
Anyone know the equivalent of \\ to ignore special characters for VB?
VB.NET将这样的引号加倍:
Dim myString As String = "this is a "" string"
For the quotation, double the quote:
"This is a ""quote"""
For everything else, you're out of luck and have to resort to Chr
"This is a string with a " & Chr(10) & "line-feed"
You can use Regex.Unescape
for using the c# style escape sequences if you want to use it for other special characters besides the double quotes. To escape the double quotes use the (already mentioned) ""
("double double quotes").
Console.WriteLine(Regex.Unescape("Test\tTest"))
Console.WriteLine(String.Format(Regex.Unescape("{0}:\t {1}"), a, x))
Ciao! Stefan
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.