External: String

montage/core/shim/string~ String

Methods

contains(content) → {boolean}

Determines whether a substring exists within this string.
Parameters:
Name Type Description
content string
Source:
Returns:
whether this string contains the given content
Type
boolean

endsWith(substring) → {boolean}

Returns whether this string ends with a given substring.
Parameters:
Name Type Description
substring string a potential substring of this string
Source:
Returns:
whether this string ends with the given substring
Type
boolean

equals(that) → {boolean}

Returns true if the two strings are equal, otherwise returns false.
Parameters:
Name Type Description
that Object The object to compare to the string.
Source:
Returns:
Returns true if the string is equal to `that`.
Type
boolean

startsWith(substring) → {boolean}

Returns whether this string begins with a given substring.
Parameters:
Name Type Description
substring string a potential substring of this string
Source:
Returns:
whether this string starts with the given substring
Type
boolean

toCapitalized() → {string}

Capitalizes the first letter in the string.
Source:
Returns:
The original string with its first letter capitalized.
Type
string
Example
var fname = "abe";
var lname = "lincoln";
var name = fname.toCapitalized() + " " + lname.toCapitalized();
// name == "Abe Lincoln"