String object

Properties
length (integer) - number of characters in the string. Read-only property.
Methods
toInteger ([defaultValue]) :  integer | defaultValue | (undefined)

Tries to parse content of the string. If parsing failed then returns defaultValue if provided, or undefined value.
toInteger expects string in the following format:

[whitespace] [{+ | }] [0 [{ x | X }]] [digits]

toFloat ([defaultValue]) :  float | defaultValue | (undefined)

Tries to parse content of the string. If parsing failed then returns defaultValue if provided, or undefined value.
toInteger expects string in the following format:

[whitespace] [sign] [digits] [.digits] [ {d | D | e | E}[sign]digits]

toString () : string

Returns string itself.

substring (start [,end]) : string | undefined

start and end are integers - zero-based indexes of first and last character. Method returns string slice consisting from characters starting from start index and up to but not included end index. If end is ommited it is interpretted as equal to length.

Negative values of start or end treated as a "right side indexes" thus expression "Script".substring(0,-1) == "Script" is valid.

substr (start [,length]) : string | undefined

start and length are integers. Start is zero-based index of first character and length is a number of characters in the slice.

Negative value of start interpreted as a "right side index" thus expression "Script".substr(-6) == "Script" is valid.

slice (start [,end]) : string | undefined

Equivalent of substring method.

concat ( [string1[, string2[, ... [, stringN]]]] ) : string

Returns string consisting from concatenated arguments:  self + string1 + string2 + string3 + + stringN.

charAt ( index ) : string.

Returns one character string. Equivalent of substr( index, 1 ). If index is out of bounds of the string then charAt returns empty string.

charCodeAt ( index ) : integer | undefined

Returns (uni)code of character at index position.

indexOf ( substring [,start] ) : integer

Searches this string for text in substring. Returns index of first occurence of substring or -1 if not found.

lastIndexOf ( substring [,start] ) : integer

Searches this string for text in substring. Returns index of last occurence of substring or -1 if not found.

localeCompare ( what ) : integer

Compares this string with what string using lexicographic character order.

match ( regexp ) : string | array of strings | null value

Returns fragment(s) of the string which satisfy regexp.

replace ( regexp, replaceBy ) : string

Returns copy of the string where all fragments satisfying regexp replaced by replaceBy.

search ( regexp ) : integer

Returns index of first occurence of string fragment satisfying regexp or -1 if not found.

split (separator[, limit]) : string

Splits the string separated on components by separator. Separator is either regexp object or string. Returns array of strings - substrings between separators. Limit is an integer - maximum number of elements in returned array.

fromCharCode ([code1[, code2[, ...[, codeN]]]]) : string

Static method. Returns string build from character with given integer codes.

toLowerCase () : string

Returns lower case copy of the string.

toUpperCase () : string

Returns upper case copy of the string.

printf ( format, [value1[, value2[, ...[, valueN]]]]) : string

Static method. Returns string formatted by the rules of sprintf C/C++ function.

Additionaly supports two format types: %v and %V. These format types accepts any value as an argument and produces source code representation of the value suitable for later parsing by eval() method. Thus iv value is an array of values it will be printed as "[element1, element2, element3... elementN]" and object (instance of Object class) will be printed as "{key1:value1, key2:value2,..., keyN:valueN}". %v produces one line output and %V tries to produce human readable output with line feeds and tabulations.