Answers for "how to search specific word from string in java"

0

how to find a word in string in java

String s = "I have an orange";
if (s.indexOf("orange") != -1){
		System.out.println("orange found");
}
Posted by: Guest on November-17-2021
0

java search string in string

You can use contains(), indexOf() and lastIndexOf() method to check if one String contains another String in Java or not. If a String contains another String then it's known as a substring. The indexOf() method accepts a String and returns the starting position of the string if it exists, otherwise, it will return -1.
Posted by: Guest on September-19-2021

Code answers related to "how to search specific word from string in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language