concatenation of non constant character array with a sting

Hello arduino people.
I read this page on string concatenation. http://arduino.cc/en/Tutorial/StringAdditionOperator

Yet, it didnt include my case.

I have a non constant character array, that later gets a value.

char clat[11];
dtostrf(gps.location.lat(), 11, 6, clat);

I want to output this:

Latitude: 20.653425

So basically i want a final string that contains: "Latitude:" + the value of the nonconstant array

Is it possible?

sprintf is the easy way, if you can afford to waste some memory for it :slight_smile:

I actually want it stored in a new string, not printed

Yes, thats what sprintf does

http://www.cplusplus.com/reference/cstdio/sprintf

You'll still need "dtostrf"; sprintf doesn't support floating point types on the Arduino.

I read this page on string concatenation. http://arduino.cc/en/Tutorial/StringAdditionOperator

Did you notice that it refers to Strings not strings by any chance ?

nikolakos:
I want to output this:

What does 'output' mean? You're trying to assemble the response into a single string - that's certainly possible, but perhaps you don't actually need to.

I need to because i want to pass the final string into a function from a library that doesnt support multiple value passing.