The following functions can be used to manipulate and retrieve string details from objects and variables.

These should be written in the following formats:

Methods

Method

Type

Description

charAt

String

Returns the character in the position specified by the index parameter.

charCodeAt

Number

Returns the numeric Unicode character code of the character at the specified index.

concat

String

Appends the supplied arguments to the end of the String object, converting them to strings if necessary, and returns the resulting string.

fromCharCode

String

Returns a string comprising the characters represented by the Unicode character codes in the parameters.

indexOf

int

Searches the string and returns the position of the first occurrence of val found at or after startIndex within the calling string.

lastIndexOf

int

Searches the string from right to left and returns the index of the last occurrence of val found before startIndex.

localeCompare

int

Compares the sort order of two or more strings and returns the result of the comparison as an integer.

match

Array

Matches the specifed pattern against the string.

replace

String

Matches the specifed pattern against the string and returns a new string in which the first match of pattern is replaced with the content specified by repl.

search

int

Searches for the specifed pattern and returns the index of the first matching substring.

slice

String

Returns a string that includes the startIndex character and all characters up to, but not including, the endIndex character.

split

Array

Splits a String object into an array of substrings by dividing it wherever the specified delimiter parameter occurs.

substr

String

Returns a substring consisting of the characters that start at the specified startIndex and with a length specified by len.

substring

String

Returns a string consisting of the character specified by startIndex and all characters up to endIndex - 1.

toLocaleLowerCase

String

Returns a copy of this string, with all uppercase characters converted to lowercase.

toLocaleUpperCase

String

Returns a copy of this string, with all lowercase characters converted to uppercase.

toLowerCase

String

Returns a copy of this string, with all uppercase characters converted to lowercase.

toUpperCase

String

Returns a copy of this string, with all lowercase characters converted to uppercase.

valueOf

String

Returns the primitive value of a String instance.

charAt

Usage: charAt(#)

Returns the character in the position specified by the index parameter.

Example:

Result:

charCodeAt

Usage: charCodeAt(#)

Returns the numeric Unicode character code of the character at the specified index.

Example:

Result:

concat

Usage: concat(arg1,arg2,...,argN)

Appends the supplied arguments to the end of the String object, converting them to strings if necessary, and returns the resulting string.

Example:

Result:

fromCharCode

Usage:

Returns a string comprising the characters represented by the Unicode character codes in the parameters.

Example:

Result:

indexOf

Usage:

Searches the string and returns the position of the first occurrence of val found at or after startIndex within the calling string.

Example:

Result:

lastIndexOf

Usage:

Searches the string from right to left and returns the index of the last occurrence of val found before startIndex.

Example:

Result:

localeCompare

Usage:

Compares the sort order of two or more strings and returns the result of the comparison as an integer.

Example:

Result:

match

Usage:

Matches the specifed pattern against the string.

Example:

Result:

replace

Usage:

Matches the specifed pattern against the string and returns a new string in which the first match of pattern is replaced with the content specified by repl.

Example:

Result:

search

Usage:

Searches for the specifed pattern and returns the index of the first matching substring.

Example:

Result:

slice

Usage:

Returns a string that includes the startIndex character and all characters up to, but not including, the endIndex character.

Example:

Result:

split

Usage:

Splits a String object into an array of substrings by dividing it wherever the specified delimiter parameter occurs.

Example:

Result:

substr

Usage:

Returns a substring consisting of the characters that start at the specified startIndex and with a length specified by len.

Example:

Result:

substring

Usage:

Returns a string consisting of the character specified by startIndex and all characters up to endIndex - 1.

Example:

Result:

toLocaleLowerCase

Usage:

Returns a copy of this string, with all uppercase characters converted to lowercase.

Example:

Result:

toLocaleUpperCase

Usage:

Returns a copy of this string, with all lowercase characters converted to uppercase.

Example:

Result:

toLowerCase

Usage:

Returns a copy of this string, with all uppercase characters converted to lowercase.

Example:

Result:

toUpperCase

Usage:

Returns a copy of this string, with all lowercase characters converted to uppercase.

Example:

Result:

valueOf

Usage:

Returns the primitive value of a String instance.

Example:

Result:


ScriptVariables

Strings (last edited 2012-10-28 05:33:13 by Inanna)