// works identically with float[] and String[]
int list[] = new list[3];
list[0] = 8;
list[1] = 67;
list[2] = 5;
String formatted = join(list, ", ");
// formatted now contains "8, 67, 5"
// to format the number of digits used
// the '3' means to pad with zeroes up to 3 digits
String withzeroes = join(list, " ", 3);
// withzeros now contains "008 067 005"
// for floats, formatting is more complicated because
// there are also digits after the decimal point.
float f[] = new float[3];
f[0] = 1.3;
f[1] = 92.8;
f[2] = 0.7;
// 3 digits on the left of the decimal point
// 2 digits to the right of the decimal point
String zerofloats = join(f, " ", 3, 2);
// zerofloats now contains "001.30 092.80 007.70"
// or if you don't want to pad the left-hand side
// a zero will say to ignore and don't pad
String lesspadding = join(f, " ", 0, 2);
// lesspadding now contains "1.30 92.80 7.70"
|