Properties | |
length | - integer, number of characters in the string. Read-only property. |
[index] | - integer, code of character at the index position, Read-write index accessor. Zero-based index. |
[begin..end] | - integers, zero-based indexes of first and last character. Returns string slice contained characters from start index and up to but not included end index. Begin or/and end are optional. If begin is ommited then it is assumed to be 0, if end - length is used as end value. |
Methods | |
toInteger |
([defaultValue]) → integer | defaultValue | (undefined) Tries to parse content of the string. If parsing failed then returns defaultValue if provided, or undefined value.
|
toFloat |
([defaultValue]) → float | defaultValue | (undefined) Tries to parse content of the string. If parsing failed then returns defaultValue if provided, or undefined value.
|
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 |
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. |
urlEscape |
() → string Returns url-escaped copy of the string if it contains characters need to be escaped or string itself if there are no such characters. |
urlUnescape |
() → string
Restores url-escaped string. |
htmlEscape |
() → string Returns string where each < > & " or ' character replaced by < > & " or ' sequence. |
htmlUnescape |
() → string
Returns string where html entities replaced by correspondent character codes. |
printf |
( format, [value1[, value2[, ...[, valueN]]]]) → string Static method. Returns string formatted by the rules of sprintf C/C++ function. Additional format types:
|