类 Newlines
java.lang.Object
com.palantir.javaformat.Newlines
Platform-independent newline handling.
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static booleancontainsBreaks(String text) Returns true if the input contains any line breaks.static intReturns the number of line breaks in the input.static intfirstBreak(String input) Returns the index of the first break in the input, or-1.static StringgetLineEnding(String input) Returns the terminating line break in the input, ornullif the input does not end in a break.static StringguessLineSeparator(String text) Returns the first line separator in the text, or"\n"if the text does not contain a single line separator.static inthasNewlineAt(String input, int idx) Returns the length of the newline sequence at the current offset, or-1.static booleanReturns true if the entire input string is a recognized line break.lineIterator(String input) Returns an iterator over lines in the input, including trailing whitespace.lineOffsetIterator(String input) Returns an iterator over the start offsets of lines in the input.
-
构造器详细资料
-
Newlines
public Newlines()
-
-
方法详细资料
-
count
Returns the number of line breaks in the input. -
firstBreak
Returns the index of the first break in the input, or-1. -
isNewline
Returns true if the entire input string is a recognized line break. -
hasNewlineAt
Returns the length of the newline sequence at the current offset, or-1. -
getLineEnding
Returns the terminating line break in the input, ornullif the input does not end in a break. -
guessLineSeparator
Returns the first line separator in the text, or"\n"if the text does not contain a single line separator. -
containsBreaks
Returns true if the input contains any line breaks. -
lineOffsetIterator
Returns an iterator over the start offsets of lines in the input. -
lineIterator
Returns an iterator over lines in the input, including trailing whitespace.
-