public static boolean isWordBoundary(@NotNull CharSequence text, int offset, boolean isCamel, boolean isStart) {
    if (offset < 0 || offset > text.length()) return false;

    final char prev = offset > 0 ? text.charAt(offset - 1) : 0;
    final char curr = offset < text.length() ? text.charAt(offset) : 0;

    final char word = isStart ? curr : prev;
    final char neighbor = isStart ? prev : curr;

    if (isJavaIdentifierPart(word)) {
      if (!isJavaIdentifierPart(neighbor)) return true;
      if (isCamel && isHumpBound(text, offset, isStart)) return true;
    }
    if (isPunctuation(word) && !isPunctuation(neighbor)) return true;

    return false;
  }
public static boolean isWordBoundary(@NotNull CharSequence text, int offset, boolean isCamel, boolean isStart)