dcsimg
Method to search a string of words
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Javed_Mandary
Posted On:   Wednesday, May 7, 2003 10:17 PM


Hi a wanna create a function that would take as paramater a string and search another string which could contain for e.g a paragraph of some text. The method should return whether the paramter i passed i.e the word i am looking for is in the paragraph.
How do i do that?
thanks Javed - Baadaal Site

Re: Method to search a string of words

Posted By:   Dheeraj_Sambhar  
Posted On:   Wednesday, May 7, 2003 10:50 PM

I hope following piece of code can help u out.


boolean testString(String s)


{


// String in which u need to search


String s1="Your Paragraph";


if(s1.indexOf(s)!= -1)

return true; // Word is in paragraph

else

return false; // Word is not in paragraph

}

About | Sitemap | Contact