Namespace: string

Methods

commonWordPrefix

static

commonWordPrefix(array, opt_shortest) returns number

Given an array of strings, return the length of the common prefix. Words may not be split. Any space after a word is included in the length.

Parameter

array

Array of string

Array of strings.

Value must not be null.

opt_shortest

Optional

number

Length of shortest string.

Returns

number Length of common prefix.

commonWordSuffix

static

commonWordSuffix(array, opt_shortest) returns number

Given an array of strings, return the length of the common suffix. Words may not be split. Any space after a word is included in the length.

Parameter

array

Array of string

Array of strings.

Value must not be null.

opt_shortest

Optional

number

Length of shortest string.

Returns

number Length of common suffix.

shortestStringLength

static

shortestStringLength(array) returns number

Given an array of strings, return the length of the shortest one.

Parameter

array

Array of string

Array of strings.

Value must not be null.

Returns

number Length of shortest string.

startsWith

static

startsWith(str, prefix) returns boolean

Fast prefix-checker. Copied from Closure's goog.string.startsWith.

Parameter

str

string

The string to check.

prefix

string

A string to look for at the start of str.

Returns

boolean True if str begins with prefix.

wrap

static

wrap(text, limit) returns string

Wrap text to the specified width.

Parameter

text

string

Text to wrap.

limit

number

Width to wrap each line.

Returns

string Wrapped text.