boolean (@NotNull String text, @NotNull TextRange range) { if (range.getLength() == 0) return false; CharacterIterator it = new StringCharacterIterator(text, range.getStartOffset(), range.getEndOffset(), range.getStartOffset()); for (char c = it.first(); c != CharacterIterator.DONE; c = it.next()) { if (!Character.isUpperCase(c)) { return false; } } return true; }