readString(); to text resend

Hello,

can somebody help me solve this?

i need get text into string from serial read.

getdata1=Serial1.readString(); /// working the variable contains text

then how to do something like this

String getdata1 = (getdata1 && "!OK"); // I need attach after readed text from serial next text

if I resend it as this Serial2.println(getdata1 && "!OK"); I will receive 1 not the text.

How can I get text from the variable getdata1 readed from serial and combine it with another text, then resend it as Ascii text to another serial port?

thank you

Daniel

i need get text into string from serial read.

Then you are going about it all wrong. That approach will get the data into a String, which is NOT the same thing.

then how to do something like this

It makes NO sense to logically AND a String and a string literal.

How can I get text from the variable getdata1 readed from serial and combine it with another text, then resend it as Ascii text to another serial port?

There is ABSOLUTELY NO need to do that. It will not make a damned bit of difference to whatever is on the other end of the serial port if you use TWO Serial.print() calls to send the data, or 12 or 1. So, use 2 to send the 2 pieces of data.

You may want to review the various String functions below to see what might best match what you want to do.

https://www.arduino.cc/en/Reference/StringObject

Have a look at Serial Input Basics - simple reliable ways to receive data.

...R