boolean (CharSequence text, int startOffset, int endOffset) { boolean hasLineBreak = false; for (int i = startOffset; i < endOffset; i++) { if (text.charAt(i) == '\n') { if (hasLineBreak) return false; hasLineBreak = true; } } return hasLineBreak; }