String

String

Author:
Source:

Methods

matchAll(re) → {array}

Uses your regular expression to find matches in the string.

Parameters:
Name Type Description
re RegExp | string

Regular expression. Either a RegExp object or a string.

Source:
Returns:

An array of objects. Each object has two fields: "string" and "index". The first one contains a matched string, the second one — the index of the first character of this string.

Type
array

shortenTo(length) → {String}

Shorten the given string to about length symbols. This method finds the closest whole word, chops it off and appends an ellipsis.

Parameters:
Name Type Description
length Integer
Source:
Throws:

KozExceptions.missingArgument, KozExceptions.invalidArgument, or their string equivalents.

Returns:
Type
String