search

goog.string.newlines.Line

Provided By

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().

new Line( string, startLineIndex, endContentIndex, endLineIndex )

Parameters
stringstring

The original string.

startLineIndexnumber

The index of the start of the line.

endContentIndexnumber

The index of the end of the line, excluding newlines.

endLineIndexnumber

The index of the end of the line, index newlines.

Instance Methods

Instance Properties