[英]what is the equivalent of visual basic withevents and handles in C#
[英]What is the Visual Basic (VB) equivalent of \ in C#?
在C#中,您可以使用\\来忽略特殊字符:
string myString = "this is a \" string";
这将作为一个完整的字符串......在VB中,这样做不起作用......
任何人都知道相当于\\忽略VB的特殊字符?
VB.NET将这样的引号加倍:
Dim myString As String = "this is a "" string"
对于报价,报价翻倍:
"This is a ""quote"""
对于其他一切,你运气不好,不得不求助于Chr
"This is a string with a " & Chr(10) & "line-feed"
如果要将其用于除双引号之外的其他特殊字符,则可以使用Regex.Unescape
来使用c#样式转义序列 。 要转义双引号,请使用(已提及) ""
(“双引号”)。
Console.WriteLine(Regex.Unescape("Test\tTest"))
Console.WriteLine(String.Format(Regex.Unescape("{0}:\t {1}"), a, x))
再见! 斯特凡
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.