Hello Processing foundation
I have this really simple question and I know it might seem very easy to do, but I cannot see how to do it correctly.
I have these 3 functions which i want to compromise to one simple function:
char[] explode(String s) {
text[0] = s;
c = new char[text[0].length()];
for (int i = 0; i < text[0].length(); i++) {
c[i] = text[0].charAt(i);
}
return c;
}
char[] explode2(String s2) {
text[1] = s2;
c2 = new char[text[1].length()];
for (int i = 0; i < text[1].length(); i++) {
c2[i] = text[1].charAt(i);
}
return c2;
}
char[] explode3(String s3) {
text[2] = s3;
c3 = new char[text[2].length()];
for (int i = 0; i < text[2].length(); i++) {
c3[i] = text[2].charAt(i);
}
return c3;
}
Thank you very much Chrisir. This works very well.
But what if I only want the explode()-function to explode specified words in the string-array (ord), and not the whole string-array?
Because first I choose a random word from the string-array, which is put in the variables text[0], text[1], and text[2], and then i want these words to be split up in chars