Microsoft® JScript™
String Object
Language Reference |
Version 1 |

See Also                   Methods                    Properties


Description
Allows manipulation and formatting of text strings and determination and location of substrings within strings.
Syntax
StringObj[.method]
"String Literal"[.method]
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 statement. Standard strings share a common, global string object. So, if a property is added to a standard string, 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 also defined for beta and all future standard string objects. In the next 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 in this fashion has its own set of members. This is the only case where the different types of string objects are handled differently.


© 1997 Microsoft Corporation. All rights reserved.