|
The String object enables manipulation and formatting of text strings and determination and location of substrings within strings.
Places an HTML anchor tag (<A>) with a NAME attribute around text. | |
Places HTML <BIG> tags around text. | |
Places HTML <BLINK> tags around text. | |
Places HTML <B> tags around text. | |
Retrieves the character as the specified index. | |
Returns the Unicode encoding of the specified character. | |
Combines two strings into one String object. | |
Places HTML <TT> tags around text. | |
Places an HTML <FONT> tag with the COLOR attribute around text. | |
Places an HTML <FONT> tag with the SIZE attribute around text. | |
Creates a string from a number of Unicode character values. | |
Finds the first occurrence of a substring within a String object. | |
Places HTML <I> tags around text. | |
Finds the last occurrence of a substring. | |
Places an HTML anchor tag (<A>) with an HREF attribute around text. | |
Performs a search on a string using the supplied Regular Expression object. | |
Replaces the text found by a regular expression with other text. | |
Searches a string for matches to a regular expression. | |
Returns a section of a string. | |
Places HTML <SMALL> tags around text. | |
Removes text from a string. | |
Places HTML <STRIKE> tags around text. | |
Places HTML <SUB> tags around text. | |
Returns a substring beginning at a specified location and having a specified length. | |
Returns the substring at a specified location. | |
Places HTML <SUP> tags around text. | |
Converts text to lowercase letters. | |
Converts text to uppercase letters. |
The length of a String object. |
StringObj[.method]
"String Literal"[.method]
method
A String object method.
String objects can be created implicitly using string literals. String objects created in this fashion (referred to as standard strings) are treated differently than String objects created using the new operator. All string literals share a common, global string object. So, if a property is added to a string literal, it is available to all standard string objects:
var alpha, beta;
alpha = "This is a string";
beta = "This is also a string";
alpha.test = 10;
In this example, test is now defined for beta and all future string literals. In the following example, however, added properties are treated differently:
var gamma, delta;
gamma = new String("This is a string");
delta = new String("This is also a string");
gamma.test = 10;
In this case, test is not defined for delta. Each String object declared as a new String object has its own set of members. This is the only case where String objects and string literals are handled differently.
Copyright 2002 Sun Microsystems, Inc. All rights reserved. Legal Notice.