How to search a word inside a string ?


perform operation:

JAVA Program

public class SearchStringEmp {
	public static void main(String[] args) {
		String strOrig = "Hello readers";
		int intIndex = strOrig.indexOf("Hello");
		if(intIndex == - 1) {
			System.out.println("Hello not found");
		} else {
			System.out.println("Found Hello at index "+ intIndex);
		}
	}
}

Output

Found Hello at index 0