boolean (@NotNull CharSequence text, int offset, boolean isStart) { if (offset <= 0 || offset >= text.length()) return false; final char prev = text.charAt(offset - 1); final char curr = text.charAt(offset); final char next = offset + 1 < text.length() ? text.charAt(offset + 1) : 0; // 0x00 is not lowercase. final char hump = isStart ? curr : prev; final char neighbor = isStart ? prev : curr; return isLowerCaseOrDigit(prev) && isUpperCase(curr) || neighbor == '_' && hump != '_' || neighbor == '$' && isLetterOrDigit(hump) || isUpperCase(prev) && isUpperCase(curr) && isLowerCase(next); }