Varrer uma STRING

3 respostas
V

Como poderia varrer uma string em JAVA do
tipo 123e5t4 ???

Vlw galera…!!!

3 Respostas

J
Assim?
String str = "123e5t4";

for(int i=0;i<str.length();i++){
   char c = str.charAt(i);
}
J

Daí depois, como ficaria por exemplo para transformar esse caracter capturado da String para Int???
Valew.

L

dai pode ser assim

String str = "123e5t4";

      for (int i = 0; i < str.length(); i++) {
         int c = (int) str.charAt(i);
      }
Criado 23 de agosto de 2006
Ultima resposta 1 de mar. de 2007
Respostas 3
Participantes 4