class HibernateSimpleQueryUtils {

    static int getIndexAfterFirstAppearanceOf(int startIndex, char character, String searchedString) {
        var queryCharCount = searchedString.length();

        if(startIndex >= queryCharCount) {
            return -1;
        }

        var indexAfterFirstAppearance = searchedString.substring(startIndex).indexOf(character) + startIndex + 1;
        if(indexAfterFirstAppearance > 0 && indexAfterFirstAppearance < queryCharCount) {
            return indexAfterFirstAppearance;
        }

        return -1;
    }

}