JavaScript Reference :: String

A string object is created by assignment of a character array (e.g. "Hello World") to a variable.

var oString = "Hello World";

methods

Anchor anchor()
Creates an anchor object from the string.
String big()
Transforms the string as if it were wrapped in a BIG tag.
String blink()
Transforms the string as if it were wrapped in a BLINK tag.
String bold()
Transforms the string as if it were wrapped in a BOLD tag.
String charAt(int index)
Returns the character in the string at the specified index.
int charCodeAt(int index)
Returns the character code for the character in the string at the specified index.
String concat(string s-1[, ... , string s-n])
Returns a concatentated string by combining specified strings with the original string.
constructor
The constructor method is the base method used to create an instance of the object.
String fixed()
Transforms the string to a fixed-width font.
String fontcolor(string color)
Transforms the string as if it were wrapped in a FONT tag with a specified color.
fontsize
Transforms the string as if it were wrapped in a FONT tag with a specified size.
String fromCharCode(int code)
Returns a string given a character code.
int indexOf(string substring)
Returns the index of the first occurrance of the substring within the string.
String italics()
Transforms the string as if it were wrapped in a italics (i.e. I) tag.
int lastIndexOf(string substring)
Returns the index of the last occurrance of the substring within the string.
Link link()
Returns a Link object from the string.
Match match(RegExp pattern)
Returns a Regular Expression match object for the specified pattern.
var oMatch = oString.match(/[b{2}]|[^b{2}]/gi);
prototype
Exposes the prototype for the method or property of the object.
String replace(RegExp pattern, string replacement)
Returns a string with pattern matches replaced by the specified replacement.
var oString = oString.replace(/[b{2}]|[^b{2}]/gi, "To be or not to be");
String search(RegExp pattern)
string small()
Returns a string transformed by the SMALL tag.
string[] split(string)
Returns an array of substrings split on the specified character.
string strike()
Returns a string transformed to a STRIKETHROUGH.
string sub()
Returns a string transformed to a subscript as if by a SUB tag.
string substr(int startingIndex[, int length])
Returns a substring of the string starting at the starting index and extending for the number of bytes specified. If no length is specified, the length is the length of the string.
string substring(int startingIndex, int endingIndex)
Returns a substring of the string between the starting index and the ending index.
string sup()
Returns a string transformed to a superscript as if by a SUP tag.
string toLowerCase()
Returns a string transformed to lowercase.
object toSource()
Returns a literal representing the source code of the object e.g "function Object() { [native code] }" or "function Car(manufactuer, model, productionyear) { this.make = manufactuer; this.model = model; this.year = productionyear; }".
string toString()
Returns a string representing the object i.e. "[object Object]".
string toUpperCase()
Returns a string transformed to uppercase.
void unwatch(property)
Removes a previously set watchpoint.
								
object valueOf()
Returns the primitive value of the object e.g. "function Object() { [native code] }".
void watch(property, handlingFunction)
Calls the handlingFunction when the property is changed.
								

properties

constructor
The constructor method is the base method used to create an instance of the object.
length
The character length of the string.
prototype
Exposes the prototype for the method or property of the object.

events