|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Senior Member
Iscritto dal: Feb 2009
Messaggi: 700
|
[Java] Controllare se una stringa contiene un'altra stringa
Ciao,
se ho 2 stringhe...come posso controllare se una contiene l'altra? Grazie Andrea |
|
|
|
|
|
#2 |
|
Senior Member
Iscritto dal: Oct 2006
Città: milano
Messaggi: 1439
|
non ne sono certo, forse questo metodo della classe String potrebbe fare al caso tuo.
Codice:
indexOf public int indexOf(String str) Returns the index within this string of the first occurrence of the specified substring. The integer returned is the smallest value k such that: this.startsWith(str, k) is true. Parameters: str - any string. Returns: if the string argument occurs as a substring within this object, then the index of the first character of the first such substring is returned; if it does not occur as a substring, -1 is returned |
|
|
|
|
|
#3 |
|
Senior Member
Iscritto dal: Jul 2007
Messaggi: 1159
|
|
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 22:34.




















