string.newlines.Line Extends
Line metadata class that records the start/end indicies of lines in a string. Can be used to implement common newline use cases such as splitLines() or determining line/column of an index in a string. Also implements methods to get line contents. Indexes are expressed as string indicies into string.substring(), inclusive at the start, exclusive at the end. Create an array of these with goog.string.newlines.getLines().

Inheritance

Constructor

goog.string.newlines.Line(stringstartLineIndexendContentIndexendLineIndex)

Parameters

string : string
The original string.
startLineIndex : number
The index of the start of the line.
endContentIndex : number
The index of the end of the line, excluding newlines.
endLineIndex : number
The index of the end of the line, index newlines.

Instance Methods

Public Protected Private
getContent() string
No description.
Returns: string  The content of the line, excluding any newline characters.
code »
getFullLine() string
No description.
Returns: string  The full line, including any newline characters.
code »
getNewline() string
No description.
Returns: string  The newline characters, if any ('\n', \r', '\r\n', '', etc).
code »

Instance Properties

endContentIndex :
Index of the end of the line, excluding any newline characters. Index is the first character after the line, suitable for String.substring().
Code »
endLineIndex :
Index of the end of the line, excluding any newline characters. Index is the first character after the line, suitable for String.substring().
Code »
startLineIndex :
Index of the start of the line.
Code »
string :
The original string.
Code »

Package string.newlines

Package Reference