class HibernateSimpleQueryUtils {

    static int getIndexAfterPhraseTerm(int startIndex, String simpleQuery) {
        var queryCharCount = simpleQuery.length();

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

        var endIndex = getIndexAfterFirstAppearanceOf(startIndex + 1, '"', simpleQuery);

        if(endIndex > 0 && endIndex < queryCharCount && simpleQuery.charAt(endIndex) == '~') {
            endIndex = getIndexAfterFirstAppearanceOfAny(endIndex, TERM_DELIMITER, simpleQuery);
        }

        return endIndex;
    }

}