OBJECT:  String


A String object, created using the String constructor, represents a series of characters in a string. The string can be enclosed between single or double quotes.

The following code shows the use of the String constructor to create a String object called 'myString'.

Code:
myString = new String("This is a string object")

PROPERTIES

constructor Property
This property returns a reference to the function that created the String object's prototype.

Syntax: object.constructor

length Property
This property returns the length of the string.

Syntax: object.length

prototype Property
This property is used to add properties and methods to an object.

Syntax: object.prototype


METHODS

anchor Method
This method is used to create an HTML anchor.

Syntax: object.anchor("name")

big Method
This method displays the string using a big font, as if contained within HTML <BIG></BIG> tags.

Syntax: object.big( )

blink Method
This method makes the displayed string blink, as if contained within HTML <BLINK></BLINK> tags.

Syntax: object.blink( )

bold Method
This method displays the string using a bold font, as if contained within HTML <B></B> tags.

Syntax: object.bold()

charAt Method
This method returns a character from a string by referring to its index within that string.

Syntax: object.charAt(index)

charCodeAt Method
This method returns a character's Unicode value from a string by referring to its index within that string.

Syntax: object.charCodeAt( index )

concat Method
This method joins the text contained in one string with the text from other specified strings and returns a new string.

Syntax: object.concat(strName2, strName3....strName[n])

fixed Method
This method displays the string using a fixed-pitch font, as if contained within HTML <TT></TT> tags.

Syntax: object.fixed()

fontcolor Method
This method displays the string using a specified color, as if contained within HTML <FONT COLOR="color"></FONT> tags.

Syntax: object.fontcolor("color")

fontsize Method
This method displays the string using a specified font size, as if contained within HTML <FONT SIZE="fontsize"></FONT> tags.

Syntax: object.fontsize("fontsize")

fromCharCode Method
This method takes the specified Unicode values and returns a string.

Syntax: String.fromCharCode(num1,....,numN)

indexOf Method
When called from a String object, this method returns the index of the first occurance of the specified searchValue argument, starting from the specified fromIndex argument.

Syntax: object.indexOf(searchValue,[fromIndex])

italics Method
This method displays the string using italics, as if contained within HTML <I></I> tags.

Syntax: object.italics()

lastIndexOf Method
When called from a String object, this method returns the index of the last occurance of the specified searchValue argument, searchng backwards from the specified fromIndex argument.

Syntax: object.lastIndexOf(searchValue,[fromIndex])

link Method
This method is used to create an HTML hyperlink in a document.

Syntax: object.link("targetURL")

match Method
This method is used to match a specified regular expression against a string.

Syntax: object.match(regexp)

replace Method
This method is used to match a specifed regular expression against a string and replace any match with a new substring.

Syntax: object.replace(regexp, newSubString)

search Method
This method is used to search for a match between a regular expression and the specified string.

Syntax: object.search(regexp)

slice Method
This method is used to 'slice' a section of a string and return a new string containing that section.

Syntax: object.slice(startSlice, endSlice)

small Method
This method displays the string using a small font, as if contained within HTML <SMALL></SMALL> tags.

Syntax: object.smal()

split Method
This method splits a string into substrings and creates an array containing the resulting substrings.

Syntax: object.split([separator][, limit])

strike Method
This method displays the string using struck-out text, as if contained within HTML <STRIKE></STRIKE> tags.

Syntax: object.strike()

sub Method
This method displays the string as subscript text, as if contained within HTML <SUB></SUB> tags.

Syntax: object.sub()

substr Method
This method extracts the characters from a string beginning at the specified start index for the specified number of characters.

Syntax: object.substr(start[, length])

substring Method
This method returns the characters in a string between two specified indices as a substring.

Syntax: object.substring(indexA, indexB)

sup Method
This method displays the string as superscript text, as if contained within HTML <SUP></SUP> tags.

Syntax: object.sup()

toLowerCase Method
This method is used to convert the characters in a string to lower case.

Syntax: object.toLowerCase( )

toSource Method
This method is used to return a string that represents the source code of the object. Note that the source code of native JavaScript objects will not be available using this method, i.e. the value returned if applying this method to the generic String object will be [native code] whereas applying it to an instance of a String object created in your code will return that code.

Syntax: object.toSource( )

toString Method
This method is used to return a string representation of an object, i.e. myString.toString() will simply return the contents of myString.

Syntax: object.toString( )

toUpperCase Method
This method is used to convert characters in a string to upper case.

Syntax: object.toUpperCase( )

valueOf Method
This method returns the primitive value of a String object as a string datatype. The value returned using this method is identical to using String.toString.

Syntax: object.valueOf


Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information