How can I type partial letters of a word to find this word?
For example: I have a string array
String[] s = {"Cartoon", "Cheese", "Truck", "Pizza"};
if I input partial letters, such as "ca","Che" or "piz"
then I can find the whole words for the list.
Thanks
stringValue.contains("string that you wanna search");
.contains will do the job, iterate over the loop and keep adding the words in ArrayList<String> for the matched ones.
This could be a good read on string in java.
.contains is like '%word%' in mysql. There are other functions like .startsWith and .endsWith in java. You may use whatever suits the best.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With