List of utility methods to do String Line Separator
int line = 1; for (int i = 0; i < offset; i++) { if (text.charAt(i) == '\n') { line++; return line;