Problems with array and for.
in
Programming Questions
•
6 months ago
Hi everyone,
I'm quiet new in the magic world of Processing and I got a little problem, and i can't fix it ...
First, i'm gonna explain my project. I want to take the number of times of each letter appair in a tex (A,B,C,D,...) make something with it (I don't know yet). But i can't get the number of each letter by using a for (because i don't know very much about array and for...).
So here is my code :
String [] texte= {
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"
};
void setup() {
size(800, 800);
textAlign(LEFT);
String [] textecomplet;
textecomplet=loadStrings("text.txt");
String texteunique;
texteunique=join(textecomplet, "");
texteunique=texteunique.toUpperCase();
String toutelettre=join(textecomplet, "");
int total =toutelettre.length();
int i = 0;
int k=0;
for (i=0; i<26;i=i+1) {
String[] a=new String[26];
a [i] = texteunique.replace(texte[i], "");
int[] a2 = new int[26];
a2[i]=a[i].length();
int[] a3 = new int[26];
a3[i] = total-a2[i];
}
}
PS : Sorry for the english, isn't my mother language.
Thanks.
1