Share via


String Object (JScript 5.6) 

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


newString = new String(["stringLiteral"])

Arguments

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

Remarks

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.

Properties

constructor Property | length Property | prototype Property

Methods

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 | localeCompare Method | match Method | replace Method | search Method | slice Method | small Method | split Method | strike Method | sub Method | substr Method | substring Method | sup Method | toLocaleLowerCase Method | toLocaleUpperCase Method | toLowerCase Method | toUpperCase Method | toString Method | valueOf Method

Requirements

Version 1

See Also

Reference

new Operator (JScript 5.6)