We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › char[] to String[]
Page Index Toggle Pages: 1
char[] to String[] (Read 341 times)
char[] to String[]
Jan 17th, 2008, 3:00pm
 
hi, i'm wanting to convert an array of characters to a String array. i'm aware of the syntax using str() but i'm finding it hard to use this in the context of the arrays.
can anyone help please?

simply, i've been trying:

char[] me = {'a', 'b', 'c'};


void setup() {
 
 String[] sb = str(me[]);
 println(sb);
}


am i even close?
Re: char[] to String[]
Reply #1 - Jan 17th, 2008, 6:27pm
 
i've found that if i have

String str = "abcde";
char[] chr = str.toCharArray();

for (int i = 0; i<chr.length; i++) {
println(chr[i]);
}

i think this fixes my problem.
Page Index Toggle Pages: 1