G43riko
1/19/2017 - 8:21 AM

JAVA Utils

public static int occurences(String string, char pattern){
	int counter = 0;
	for(int i=0 ; i<string.length() ; i++){
		if(string.charAt(i) == pattern){
			counter++;
		}
	}
	return counter;
}

public static bool hasOccurences(String string, char pattern, int limit){
	int counter = 0;
	for(int i=0 ; i<string.length() ; i++){
		if(string.charAt(i) == pattern){
			counter++;
			if(counter > limit){
				return true
			}
		}
	}
	return false;
}