JavaScript: String object reference
Lists the String object methods and properties.
Back to JavaScript: Strings
String object methods:
charAt(index) |
Returns the character at the specified index position. |
charCodeAt(index) |
Returns the Unicode value of the character at the specified index position. |
concat(string1,...) |
Joins two or more strings and returns the result. Requires at least one string as an argument. |
indexOf(substring,index) |
Returns the position in the index at which the |
lastIndexOf(string,index) |
Returns the position of the last occurrence of a substring, searching backwards from the specified position in a string. Second argument is not required but defines where the search starts looking from. Returns -1 if not found. |
match(substring) |
Searches for and returns a substring in a string. Returns null if not found. |
replace(substring,string) |
Replaces a substring with a string. |
search(substring) |
Searches a string for a substring. Returns the index position. Returns -1 if not found. |
slice(index,index) |
Returns selected substring from a string specified by the index positions. Only the first argument is required. |
split('delimiter',number) |
Separates the string into an array of sustrings based on the delimiter. Only the first argument is required the second defines the number of splits. |
substr(index,length) |
Extracts a specified number of characters in a string, from the start index. If the second argument is not specified then extracts to the end of the string. |
substring(index,index) |
Returns selected substring from a string specified by the index positions. If the second argument is not specified then extracts to the end of the string. |
String object properties:
length |
Returns the number of characters in a string. |
Back to top.
Copyright © 2006-2010 justfigures.co.uk
