String object

The String objects allow you to perform advanced string manipulations. The String object can be created using the one of the following syntaxes:

var StrObject = new String("Initial value");
var FixedString = new String(256); // create an empty string, 256 characters long

The second variation allows you to allocate a fixed text buffer which can be used to communicate with external DLL libraries.


Constructors

String Creates an empty string object.
String Creates a new string object and assigns it a specified value.
String Creates a new string buffer of a specified size

Methods

Substring Extracts a substring by specifying the start and end positions within the original string
Substr Extracts a substring by specifying the start position and length of the fragment
ToUpperCase Converts the string to upper case
ToLowerCase Converts the string to lower case
IndexOf Searches the string for a specified substring.
Split Splits string into a list of values.

Attributes

Type (read only) Returns always "string"
Length (read only) Returns the length of the string (in characters)
Capacity Specifies the current size of the underlying character buffer of this string object.

String()

Creates an empty string object.


String(StringValue)

Creates a new string object and assigns it a specified value.

Parameters

StringValue
The string value to be assigned to the string object

String(BufferSize)

Creates a new string buffer of a specified size

Parameters

BufferSize
The size of the string buffer to be allocated

Remarks

String objects created this way are intended for passing fixed string buffers to DLL libraries


Substring(Start, End)

Extracts a substring by specifying the start and end positions within the original string

Parameters

Start
A start position of the substring to be extracted
End
An end position of the substring to be extracted

Return value

Returns the extracted substring.


Substr(Start, Length)

Extracts a substring by specifying the start position and length of the fragment

Parameters

Start
A start position of the substring to be extracted
Length
A length of the substring to be extracted (optional, defaults to the end of the string)

Return value

Returns the extracted substring.


ToUpperCase()

Converts the string to upper case

Return value

Returns the string converted to upper case.


ToLowerCase()

Converts the string to lower case

Return value

Returns the string converted to lower case.


IndexOf(Substring, Starting)

Searches the string for a specified substring.

Parameters

Substring
A substring to search for
Starting
A position from which to start searching (optional, defaults to the beginning of the string)

Return value

Returns the position of the substring within the searched string or -1 of the substring cannot be found.


Split(Separators)

Splits string into a list of values.

Parameters

Separators
Characters to be used as item separators (optional, default=",")

Return value

Returns an Array object containing items of an original string.