List of utility methods to do String Line Count
int | countLine(CharSequence str) count Line int count = 0; for (int i = 0; i < str.length(); i++) { if (str.charAt(i) == '\n') count++; if ((str.length() > 0) && (str.charAt(str.length() - 1) != '\n')) count++; return count; ... |
int | countLine(String content) count Line return countHappens('\n', content) + 1; |
int | countLine(String contents, int index) count Line int count = 0; if (index < 0 || index > contents.length()) { return 0; for (int i = 0; i < index; i++) { if ('\n' == contents.charAt(i)) count++; return count; |
int | countLineBreaks(final String replacementString) count Line Breaks int lineBreaks = 0; int ignoreNextNAt = -1; final int len = replacementString.length(); for (int i = 0; i < len; i++) { char c = replacementString.charAt(i); if (c == '\r') { lineBreaks++; ignoreNextNAt = i + 1; ... |
int | countLineBreaks(String text) count Line Breaks char[] chars = text.toCharArray(); int count = 0; for (int index = 0; index < text.length(); index++) { if (chars[index] == '\n') { count++; return count; ... |
int | countLineEnds(CharSequence string, int startPos) Returns the number of line ends considering returns and new lines in string after startPos .
int count = 0; int i = startPos; while (i < string.length()) { char c = string.charAt(i); if ('\r' == c) { count++; i = advanceIfNextIsNewLine(string, i); } else if ('\n' == c) { ... |
int | countLines(final String content, final String lineBreak) count Lines if (content == null) { return -1; int lastPos = content.indexOf(lineBreak); int count = 1; while (lastPos >= 0) { lastPos = content.indexOf(lineBreak, lastPos + 1); count++; ... |
int | countLines(String aMessage) count Lines int lastPos = 0; int count = 1; while (-1 != (lastPos = aMessage.indexOf("\n", lastPos + 1))) { ++count; return count; |
int | countLines(String buffer) Counts the number of lines in the buffer. int count = 0; int index = buffer.indexOf('\n'); while (index != -1) { count++; index = buffer.indexOf('\n', index + 1); return count; |
Integer | countLines(String data) Counts the number of lines in this String. if (data == null) { return null; return data.split("\r\n|\r|\n").length; |