Module: strings

Classes

strings.Highlight
strings.HighlightedText
strings.Pattern

Methods

(static) strings.escapeCharactersWithSpecialMeaningInRegExp(str) → {string}

Escapes characters with special meaning in RegExp.

Parameters:
Name Type Description
str string

the string to escape.

Source:
Returns:

the escaped string.

Type
string

(static) strings.highlight(text, patterns) → {strings.HighlightedText}

Highlights all occurrences of a given set of patterns in a string.

Parameters:
Name Type Description
text string

the text to highlight.

patterns Array.<strings.Pattern>

a set of patterns to match and highlight.

Source:
Returns:

the highlighted text.

Type
strings.HighlightedText

(static) strings.isNullOrBlank(str) → {boolean}

Returns true iif a string is either null or blank, false otherwise.

Parameters:
Name Type Description
str string

the string to check.

Source:
Returns:

true if the string is null or blank, false otherwise.

Type
boolean

(static) strings.isNumeric(str) → {boolean}

Checks if a string represents a numeric value.

Parameters:
Name Type Description
str string

the string to check.

License:
  • The code is extracted from https://stackoverflow.com/a/175787.
Source:
Returns:

true if the string is a number, false otherwise.

Type
boolean

(static) strings.pad(str, targetLength) → {string}

Prepends '0' to a string or number until a given length is reached.

Parameters:
Name Type Description
str string | number

a string or number.

targetLength number

the string target length.

Source:
Returns:

a padded string.

Type
string

(static) strings.removeDiacritics(str, preserveStringLength) → {string}

Removes diacritical marks from a string.

Parameters:
Name Type Description
str string

the string to clean.

preserveStringLength boolean

true iif the original string length must be preserved.

License:
  • The code is extracted from https://web.archive.org/web/20121231230126/http://lehelk.com:80/2011/05/06/script-to-remove-diacritics/.
Source:
Returns:

the cleaned text i.e. without diacritical marks.

Type
string

(static) strings.toRegExp(str, flags) → {RegExp}

Converts a string to a RegExp literal.

Parameters:
Name Type Description
str string

the string to convert.

flags string

the flags of the regular expression.

Source:
Returns:

a RegExp.

Type
RegExp

(static) strings.unpad(str) → {string}

Removes all '0' from the beginning of a string.

Parameters:
Name Type Description
str string

a string.

Source:
Returns:

an un-padded string.

Type
string