String
 
 
 

String values consist of a single character or collection of single characters. The length of the string is variable and can be a chain of zero or more characters (letters, digits, and punctuation marks) strung together. You use the string data type to represent text. String literals can be included in your scripts by enclosing them in matching pairs of single or double quotation marks. The following are examples of strings:

"Jerry saw the penguin and froze."

'"Where did you come from?" asked the king.'

"128"

'z'

A string that contains zero characters ("") is an empty (zero-length) string. The BSTR (Basic or Binary String) data type is a pointer to a wide character string used in Automation manipulation.

Note

Because of Unicode support each BSTR character is normally expressed as two bytes rather than a single byte.

Language

Comments

VBScript

The VBScript String type contains a variable-length string that can be up to approximately 2 billion characters in length. In addition to the String type, VBScript also supports the Byte type, which represents a single character (like C++'s char).

JScript

JScript uses a String object, which implements several methods and properties that allow you to manipulate and format text strings or locate substrings within strings. There is no type to represent a single character (such as C++'s char or VBScript's Byte); to represent a single character in JScript, you can create a string that consists of only one character.

PerlScript

PerlScript does not have a specific type that represents strings. Use the Scalar type.

Python

Python does not have a type to represent a single character (such as C++'s char). To represent a single character in Python, you create a string that consists of only one character.

C++

The C++ API implements strings as a XSI::CString, with functions and operators for creating, concatenating, and comparing wide character strings together.

C#

The C# string type (System.String) represents a string of Unicode characters.

Note

See Comparing Data Types across Languages for a table that compares the string data type across several different languages.

For high-level information about how these languages approach data type in general, see one of the following topics: