Existe alguma método em java que permita procurar uma string dentro de outra istring, como tem a função instr no vb?
Método INSTR
L
1 Resposta
B
indexOf(String str)
Returns the index within this string of the first occurrence of the specified substring.
Por exemplo:
String txt = "Java rula fortemente";
int index = txt.indexOf("rula");
é isto que voçê quer?
Se não me engano ele returna -1 se não encontrar a substring…
PEACE!
Criado 10 de fevereiro de 2003
Ultima resposta 10 de fev. de 2003
Respostas 1
Participantes 2