By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,602 Members | 1,507 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,602 IT Pros & Developers. It's quick & easy.

Creating a string that contains inverted commas inside it

P: n/a
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

Jun 5 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
weird0 wrote:
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\"";
--
Tom Porterfield
Jun 5 '07 #2

P: n/a
Regular quote characters?

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

Marc
Jun 5 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.