string.newlines

Classes

goog.string.newlines.Line
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().

Public Protected Private

Global Functions

goog.string.newlines.getLines(str) !Array.<!goog.string.newlines.Line>
Splits a string into an array of line metadata.
Arguments:
str : string
String to split.
Returns: !Array.<!goog.string.newlines.Line>  Array of line metadata.
code »
goog.string.newlines.splitLines(stropt_keepNewlines) !Array.<string>
Splits a string into lines, properly handling universal newlines.
Arguments:
str : string
String to split.
opt_keepNewlines : boolean=
Whether to keep the newlines in the resulting strings. Defaults to false.
Returns: !Array.<string>  String split into lines.
code »

Package string

Package Reference