boolean (@NotNull CharSequence cs, @NotNull CharSequence baseSequence, int startOffset, int endOffset) { if (cs.length() != endOffset - startOffset) return false; if (cs == baseSequence && startOffset == 0) return true; for(int i = 0, len = cs.length(); i < len; ++i) { if (cs.charAt(i) != baseSequence.charAt(startOffset + i)) return false; } return true; }