Adding Carriage Return <CR> and CTRL-Z to a String in java

java

Solution

To get this string:

"+33146290800"<CR>Please call me soon.<ctrl-Z>

You use this string literal:

String s = "\"+33146290800\"\rPlease call me soon.\u001A";

`\"` is the Java string literal escape sequence for a double quote, `\r` is escape sequence a carriage return, and `\u0026` is the Java string literal Unicode escape sequence for character x1A (decimal 26), e.g., Ctrl+Z. More to explore in the JLS.

Problem

I am working to send SMS using java program. The AT command is supping as a string. But the string format should be like `AT+CMGS="+33146290800"<CR>Please call me soon.<ctrl-Z>`. I have to create string with the Carriage Return and CTRL-Z character. If I add 0x0D and 0x1A with the string. output: ``` AT+CMGS="+33146290800"13Please call me soon.26 ``` How can I achieve the task? Can anyone help me to find a way out.

Original source