Built-In Class String

A built-in class for sequences of UTF-16 characters forming a "string" of textual data.

Field Summary
Field Attributes Field Name and Description
<JavaScript 1.7+>  
lc
A quick shorthand getter to return the lower case version of a string
<JavaScript 1.7+>  
A quick shorthand getter to return the first letter upper case version of a string
<JavaScript 1.7+>  
uc
A quick shorthand getter to return the upper case version of a string
<JavaScript 1.7+>  
A quick shorthand getter to return the first letter upper case version of a string
Method Summary
Method Attributes Method Name and Description
 
contains(other)
Check and see if this string contains another
 
endsWith(other)
Check and see if this string ends with another
 
expand(len)
Expand a string repeating it up to a certain length.
 
numberOf(other, offset)
Count the number of times a substring is found within this string
 
pad(len, chars)
Pad a string on both sides to a certain length If the string is equal to or larger than that length then it's size will be left alone
 
padLeft(len, chars)
Pad a string on the left side to a certain length If the string is equal to or larger than that length then it's size will be left alone
 
padRight(len, chars)
Pad a string on the right side to a certain length If the string is equal to or larger than that length then it's size will be left alone
 
partition(sep)
Partition a string.
 
Same as string.partition but from the rightmost occurence of the separator
 
repeat(num, separator)
Repeat a string a number of times.
 
Reverse the order of characters in this string
 
startsWith(other)
Check and see if this string starts with another
 
strip(chars, internal)
Strip characters from both sides of the string
 
stripLeft(chars)
Strip characters from the left side of the string
 
stripRight(chars)
Strip characters from the right side of the string
 
Converts a dash (foo-bar) or underscore (foo_bar) style name into a cammel case (fooBar) name.
 
Converts a cammel case (fooBar) name into a dash (foo-bar) style name.
 
Return a version of this string with the first character in lower case
 
Return a version of this string with the first character in upper case
 
Return a version fo this string with all words matched by \w given an upper case first character.
 
Converts a cammel case (fooBar) name into an underscore (foo_bar) style name.
Field Detail
<JavaScript 1.7+> {String} lc
A quick shorthand getter to return the lower case version of a string
Defined in: Getters.js.
See:
String#toLowerCase

<JavaScript 1.7+> {String} lcfirst
A quick shorthand getter to return the first letter upper case version of a string
Defined in: Getters.js.
See:
String#toFirstLowerCase

<JavaScript 1.7+> {String} uc
A quick shorthand getter to return the upper case version of a string
Defined in: Getters.js.
See:
String#toUpperCase

<JavaScript 1.7+> {String} ucfirst
A quick shorthand getter to return the first letter upper case version of a string
Defined in: Getters.js.
See:
String#toFirstUpperCase
Method Detail
{Boolean} contains(other)
Check and see if this string contains another
Parameters:
other
Returns:
{Boolean} A boolean indicating if this string contains another

{Boolean} endsWith(other)
Check and see if this string ends with another
Parameters:
other
Returns:
{Boolean} A boolean indicating if this string ends with another

{String} expand(len)
Expand a string repeating it up to a certain length.
Parameters:
{Number} len
The length of the string to expand to
Returns:
{String} the expanded string

{Number} numberOf(other, offset)
Count the number of times a substring is found within this string
Parameters:
{String} other
The substring to search for
{Number} offset Optional, Default: 0
The offset from the start of the string for the search
Returns:
{Number} An integer indicating how many times the substring is found

pad(len, chars)
Pad a string on both sides to a certain length If the string is equal to or larger than that length then it's size will be left alone
Parameters:
{Number} len
The length to pad the string to
{String} chars Optional, Default: " "
The characters to pad the string with

padLeft(len, chars)
Pad a string on the left side to a certain length If the string is equal to or larger than that length then it's size will be left alone
Parameters:
{Number} len
The length to pad the string to
{String} chars Optional, Default: " "
The characters to pad the string with

padRight(len, chars)
Pad a string on the right side to a certain length If the string is equal to or larger than that length then it's size will be left alone
Parameters:
{Number} len
The length to pad the string to
{String} chars Optional, Default: " "
The characters to pad the string with

{Array} partition(sep)
Partition a string. This breaks up a string by the first occurence of a separator and returns a 3 item array containing the part before the separator, the separator itself, and the part after the separator. If the separator is not found then the returned array will contain the string followed by two empty strings.
Parameters:
{String|RegExp} sep
The separator to split by
Returns:
{Array} The three item partitioned array
See:
http://docs.python.org/library/stdtypes.html#str.partition

{Array} partitionRight(sep)
Same as string.partition but from the rightmost occurence of the separator
Parameters:
{String} sep
The separator to split by
Returns:
{Array} The three item partitioned array
See:
String#partition

{String} repeat(num, separator)
Repeat a string a number of times.
Parameters:
{Number} num
The number of times to repeat
{String} separator
An optional separator to insert in between the strings
Returns:
{String} the repeated string

{String} reverse()
Reverse the order of characters in this string
Returns:
{String} A new string with characters in the reverse order

{Boolean} startsWith(other)
Check and see if this string starts with another
Parameters:
other
Returns:
{Boolean} A boolean indicating if this string starts with another

{String} strip(chars, internal)
Strip characters from both sides of the string
Parameters:
{String} chars
The characters to remove
internal
Returns:
{String} The new stripped string

{String} stripLeft(chars)
Strip characters from the left side of the string
Parameters:
{String} chars
The characters to remove
Returns:
{String} The new stripped string

{String} stripRight(chars)
Strip characters from the right side of the string
Parameters:
{String} chars
The characters to remove
Returns:
{String} The new stripped string

{String} toCamelCase()
Converts a dash (foo-bar) or underscore (foo_bar) style name into a cammel case (fooBar) name.
Returns:
{String} The new cammel case style string

{String} toDash()
Converts a cammel case (fooBar) name into a dash (foo-bar) style name.
Returns:
{String} The new dash style string

{String} toFirstLowerCase()
Return a version of this string with the first character in lower case
Returns:
{String} The string with the modified case

{String} toFirstUpperCase()
Return a version of this string with the first character in upper case
Returns:
{String} The string with the modified case

{String} toTitleCase()
Return a version fo this string with all words matched by \w given an upper case first character.
Returns:
{String} The string with the modified case

{String} toUnderscore()
Converts a cammel case (fooBar) name into an underscore (foo_bar) style name.
Returns:
{String} The new underscore style string