public static int count(char pattern, @Nullable String text) {
		if (text == null || text.isEmpty())
			return 0;
		int count = 0;
		int length = text.length();
		for (int i = 0; i < length; i++) {
			if (text.charAt(i) == pattern) count++;
		}
		return count;
	}
@param pattern
		Pattern to look for.
@param text
		Text to check.

@return Number of times the given pattern appears in the text.
recaf-core/src/main/java/software/coley/recaf/util/StringUtil.java