1

I have to affect special characters to a string variable like \* or """ or '' I remarked that the comment worked very well because they are contained in "" so they are considered like string.The problem is how i can i force that """ will be considered as string .

my code:

if (line.StartsWith("/*") || line.StartsWith("""""));

or

string a= """""

help me please

4

1 回答 1

3

You need to escape the quotes:

line.StartsWith("\"\"\"") 

The \ acts as an escape character, which prevents the quote from ending the string, and treats it instead as an embedded quotation character.

于 2013-06-14T16:34:54.920 回答