String Methods

The following example displays a summary of the string methods. Detailed descriptions of each method follow the table.

MethodDescription

anchor

Creates an HTML anchor that is used as a hypertext target.

big

Causes a string to be displayed in a big font as if it were in a BIG tag.

blink

Causes a string to blink as if it were in a BLINK tag.

bold

Causes a string to be displayed as if it were in a B tag.

charAt

Returns the character at the specified index.

charCodeAt

Returns a number indicating the ISO-Latin-1 codeset value of the character at the given index.

concat

Combines the text of two strings and returns a new string.

fixed

Causes a string to be displayed in fixed-pitch font as if it were in a TT tag.

fontcolor

Causes a string to be displayed in the specified color as if it were in a <FONT COLOR=color> tag.

fontsize

Causes a string to be displayed in the specified font size as if it were in a <FONT SIZE=size> tag.

fromCharCode

Returns a string from the specified sequence of numbers that are ISO-Latin-1 codeset values.

indexOf

Returns the index within the calling String object of the first occurrence of the specified value.

italics

Causes a string to be italic, as if it were in an I tag.

lastIndexOf

Returns the index within the calling String object of the last occurrence of the specified value.

link

Creates an HTML hypertext link that requests another URL.

match

Used to match a regular expression against a string.

replace

Used to find a match between a regular expression and a string, and to replace the matched substring with a new substring.

search

Executes the search for a match between a regular expression and a specified string.

slice

Extracts a section of a string and returns a new string.

small

Causes a string to be displayed in a small font, as if it were in a SMALL tag.

split

Splits a String object into an array of strings by separating the string into substrings.

strike

Causes a string to be displayed as struck-out text, as if it were in a STRIKE tag.

sub

Causes a string to be displayed as a subscript, as if it were in a SUB tag.

substr

Returns the characters in a string beginning at the specified location through the specified number of characters.

substring

Returns the characters in a string between two indexes into the string.

sup

Causes a string to be displayed as a superscript, as if it were in a SUP tag.

toLowerCase

Returns the calling string value converted to lowercase.

toUpperCase

Returns the calling string value converted to uppercase.