Word in string can be find by indexOf of method in java. This method returns a numeric value of word's position in a string. First character of the string positioned at zero number. If no word is found in string, it will return value less than 0.
Example of finding word in java.
<%@ page language="java"%> <% String str="This is long string to find word in jsp"; %> <html> <head> <title>How to find word in Java</title> </head> <body> <% // Searching long word in string if(str.indexOf("long")>=0) { out.print("Yes word is found successfully"); } else { out.print("No word is found successfully"); } %> </body> </html>





Link to Us