Skip to content

Latest commit

 

History

History
23 lines (15 loc) · 780 Bytes

FindPhrase.md

File metadata and controls

23 lines (15 loc) · 780 Bytes

FindPhrase

Many times we have to find number of times a string is found in a bigger string of our choice, and finding a solution efficiently might take quite a time, on a not-so good day. Hence this class, which helps you find what you're looking for, easily.

To use this class, just make a simple object of FindPhrase class and call timesFound(string, phrase) method which returns you the number of times, phrase was found in the string.

public int timesFound(String string, String phrase){
	// returns number of times phrase was found in the string
}

Example code, for understanding:

public static void main(String[] args){

	FindPhrase fp = new FindPhrase();
		
	System.out.println(fp.timesFound("SOSSOSOS", "OS")); // returns 3
    
}