String valuesz = et.getText().toString();
String valuez2 = et2.getText().toString();
boolean found = (valuez.contains(valuez2));
if (found)
Log.d(TAG, "found");
Search if text of a textfield is contained inside another
Vra
I have two edittexts, et and et2. What I want it to be seached if the string given from et2 is contained in et. I use:
valuez = et.getText().toString();
length = valuez.length();
valuez2 = et2.getText().toString();
length2 = valuez2.length();
for (int i=0; i<length; i++) {
for (int j=0; j<length2; j++) {
if (valuez.charAt(i) != valuez2.charAt(j)) {
continue;
}
if (j == length2) {
System.out.println("Found");
break;
}
}
}
But that doesn't seem to work. Any ideas? Thanks a lot
Oplossing
Gelisensieer onder: CC-BY-SA met toeskrywing
Nie verbonde aan StackOverflow