String (int rangeStart, int rangeEnd, @NotNull CharSequence seq) { int firstLineStart = CharArrayUtil.shiftForward(seq, rangeStart, " \t"); if (firstLineStart < seq.length() - 1 && seq.charAt(firstLineStart) == '\n') firstLineStart++; int lastLineEnd = CharArrayUtil.shiftBackward(seq, rangeEnd - 1, " \t"); if (lastLineEnd > 0 && seq.charAt(lastLineEnd) == '\n') lastLineEnd--; if (lastLineEnd < firstLineStart) return null; return seq.subSequence(firstLineStart, lastLineEnd).toString(); }