We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hola ojala me puedan ayudar. Estoy leyendo un archivo.txt con datos los cuales almaceno en un array. Ahora deseo leer el archivo y contar las veces que se repite cada carácter y al final imprimir la lista de caracteres con el numero de veces que este re repite. Alguien me puede decir como podría hacerlo.
String[] lines;
String dato[];
int index = 0;
void setup() {
size(200, 200);
background(0);
lines = loadStrings("abra.txt");
if (index < lines.length) {
dato = split(lines[index], ',');
index=index+1;
println(dato);
}
int []charFreqs = new int[256];
for(char c: dato.toCharArray){
charFreqs[c]++;
}
}
Answers
could you post the first 6 lines of abra.txt ?
in line 10 you need a for-loop to loop over "lines"
it might be easier to get answers when you write in English
;-)
Hi thanks Chrisir the txt file has only one series of numbers, for example because: 123,136,87,123,169,213,214,72,16,3,3,2,123,123.
sorry but my English is not very good.
English version: http://forum.processing.org/two/discussion/10202/characters-in-an-array-with-repetition-number
Better edit this thread (as I closed the other), to put the English version here.
solved?