Making Assorted Variables into a String

I am writing a sketch to send data to a python program via ethernet. The easy way, from the Python point of view, is to combine everything into a string and send that string in one client.print command.

The problem is that I don't know haw to combine the variables and string. What is the right way of doing what I tried to do in the following?

            int sensread = analogRead(3);
            float degreex = Temperature(sensread);
             
            char allin[25] = sensereadi + " node 1 " + degreex;

            client.print(allin);

Thanks,
JP.

Thanks Delta,

I thought that that was a good idea too, in fact it was the first thing that I tried, but only the first, and sometimes the second client.print would show up in my Python. I tried a whole bunch of things in Python before I went back to the Arduino to try sending data in a different format.

What I found was that as long as the data was in one client.print, even a thousand characters would transfer successfully.

JP.

I guess something like this will work,

client.print(allin, "Temperature = %i, Analogue is %i", degreedec, sensread);

JP.

It is working. The only additional problem was that I could not get a float to work, %f, so I scaled the one value by a factor of ten and sent it as an integer too.

            int sensread = analogRead(3);
            float degreex = Temperature(sensread);
            int degreedec = 10*degreex;
            
            char allin[45];
            
            sprintf(allin, "Temperature = %i, Analogue is %i", degreedec, sensread);
            
            client.print(allin);

JP.

The below sketch builds this String:

Result: 3.1452549 Volts

If you don't need float variables you could just use sprintf() NS char array

void setup() {
Serial.begin(9600);
 char tmp[25];
 float val=3.14525478;

String tmp2="Result: ";
String tmp3=" Volts";
dtostrf(val,1,7,tmp);
String output=tmp2+tmp+tmp3;
Serial.println(output);
}

void loop() {
 }