Make a String from an array?


#1

Hi, 

Is there a more elegant way to do that (in order to wrap C code, don't ask me why it is an array of longs). 

long foo[4] = { 0, 1, 2, 3 };

String bar(static_cast<int>(foo[0]));

bar << " " << static_cast<int>(foo[1])
    << " " << static_cast<int>(foo[2])
    << " " << static_cast<int>(foo[3]);

I briefly searched in the forum (and in the documentation) an obvious trick without success, thanks.


#2

You could make a StringArray from it, then call joinIntoString


#3

I suppose that joinIntoString would be more efficient for many values. 

But as i can not see an easy way to contruct a StringArray with a C array, and as i only need to manage few integers, i guess i'll keep on with my approach.

Thanks anyway.