Creating a string that contains inverted commas inside it

  • Thread starter Thread starter weird0
  • Start date Start date
W

weird0

I have to create a string that contains inverted commas inside it.
How can i do that in c#?

As follows:-

"AT+CMGF=1"
string temp=""AT+CMGF=1""; // not valid
 
weird0 said:
I have to create a string that contains inverted commas inside it.
How can i do that in c#?

As follows:-

"AT+CMGF=1"
string temp=""AT+CMGF=1""; // not valid

I've never heard them called inverted commas before. Usually those are
called quotation marks when found in pairs like that. Since the
quotation mark is the string begin/end character in C#, you need to
escape them to embed them in a string. Ex:

string temp = "\"AT+CMGF=1\"";
 
Regular quote characters?

string temp="\"AT+CMGF=1\"";
or
string temp=@"""AT+CMGF=1""";

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top