String Object

Allows manipulation and formatting of text strings and determination and location of substrings within strings.


newString = new String(["stringLiteral"])


Required. The variable name to which the String object is assigned.
Optional. Any group of Unicode characters.


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. 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 the previous 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.


constructor Property | length Property | prototype Property


anchor Method | big Method | blink Method | bold Method | charAt Method | charCodeAt Method | concat Method | fixed Method | fontcolor Method | fontsize Method | fromCharCode Method | indexOf Method | italics Method | lastIndexOf Method | link Method | match Method | replace Method | search Method | slice Method | small Method | split Method | strike Method | sub Method | substr Method | substring Method | sup Method | toLowerCase Method | toUpperCase Method | toString Method | valueOf Method


Version 1

See Also

new Operator