Page 1 of 1

Sending String with inverted commas as part of it

Posted: Tue Aug 27, 2019 3:19 pm
by jollybv
Hi Guys

How would I send a string like this AT+CSCS="GSM" with the inverted commas included

I have tried
String = "AT+CSCS="
String = String + ""GSM""

But this formula is not right

Re: Sending String with inverted commas as part of it

Posted: Tue Aug 27, 2019 5:15 pm
by Benj
Hello,

This is the way I might do it.

"AT+CSCS=\"GSM\""

The slashes in front of the speech mark allows it to be escaped.
https://en.wikipedia.org/wiki/Escape_sequences_in_C

Re: Sending String with inverted commas as part of it

Posted: Wed Aug 28, 2019 7:26 am
by jollybv
Hi Ben

Thanks for the reply i managed to sort it looking back at some old code
send = "AT+CSCS="
send = send + "\""
send = send + "GSM"
send = send + "\""

But I will use your code as it is way less code