paribe
#1
Olá,
no comando abaixo porque o resultado é 4 o que o comando indexOf está fazendo ???
alguém pode ma ajudar …
String s=" abcdcba ";
int x=2;
s=s.trim();
if (s.length()<8){
x= s.indexOf('c', 3);
}
System.out.println("x="+x);
public int indexOf(String str,
int fromIndex)
Returns the index within this string of the first occurrence of the specified substring, starting at the specified index.
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html#indexOf(java.lang.String,%20int)
Ele está pegando, a partir da posição 3, a primeira posição onde o ‘c’ aparece.
[]'s