Arduino ESP8266 peripheral - Problem understanding Escape Character parsing

Hi
I am developing an application whereby two Arduino Nano's inter communicate as a 'data link' via ESP8266 peripherals. I am using the ESP8266_TCP library to develop functions to Tx and Rx data between the TCP client and server ESP's. However, despite many hours looking at related posts on various forums I am still somewhat confused on how to parse AT commands correctly when creating my own functions. I understand that is is necessary to precede double quotes, where they occur INSIDE the overall string using ''. But, for example I cant get my head around the examples below which include string variables as part of the overall function call.

So, can anyone please enlighten me on the parsing rules and the use of escape characters.

I assume ssid and password are string variables in the examples given.

Example 1

sendData("AT+CWJAP=\"" + ssid + "\",\"" +password + "\"");

Example 2

write("AT+CWSAP=\"" + ssid +"\",\""+password+"\","+String(channel)+",4");

Many thanks in anticipation of any help.

Parsing is the act of taking a string apart, and making sense of the data in the string. Neither of your examples involves parsing.

They DO make use of the completely unnecessary String class and its overload of the + operator to concatenate string.

If ssid contains Smith and password contains Wesson, the result passed to sendData will be AT+CWJAP="Smith","Wesson" with the double quotes embedded.

I assume ssid and password are string variables in the examples given.

Lower case string like a null terminated char array or do you mean String class instances? (With capital S)

Thanks for both your replies. I am a beginner trying to decipher the mysteries and rules relating to the use of of using escape characters so that I can apply them correctly in my own Arduino /ESP coding. My examples relate to code within the ESP8266_TCP library so in answer to your query:

..or do you mean String class instances?

the variables, i think are then String class instances.

Regarding:

They DO make use of the completely unnecessary String class and its overload of the + operator to concatenate strings.

Is there an alternative to this approach? Also, are there rules relating to C/C++ escape characters that I should be aware of as I develop my programming skills? I am having difficulty finding clear references or tutorials online.

Many thanks again (for your time and patience).

Your escape characters have nothing to do with ESP8266 or String class, just standard character input in C/C++

when you want to write a special character in between single of double quote, you escape that character with an \ → they are officially documented

the reason for asking if you were using String or string is because the + operator will do the right thing only if you have a String Object in the expression

That’s very helpful JML. I am now on the ‘right track’ and can now proceed to develop my Arduino sketches and C++ programming using AT commands and escape character sequences. Thanks again for the clarification.