Sending String with inverted commas as part of it

Tips, Tricks and methods for programming, learn ways of making your programming life easier, and share your knowledge with others.

Moderators: Benj, Mods

Post Reply
User avatar
jollybv
Flowcode v5 User
Posts: 357
Joined: Thu Feb 12, 2009 5:20 am
Location: Cape Town
Contact:

Sending String with inverted commas as part of it

Post 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

User avatar
Benj
Matrix Staff
Posts: 14827
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: Sending String with inverted commas as part of it

Post 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

User avatar
jollybv
Flowcode v5 User
Posts: 357
Joined: Thu Feb 12, 2009 5:20 am
Location: Cape Town
Contact:

Re: Sending String with inverted commas as part of it

Post 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

Post Reply