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.


Конструкторы

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

Методы

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.

Атрибуты

Type (только для чтения) Returns always "string"
Length (только для чтения) 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.

Параметры

StringValue
The string value to be assigned to the string object

String(BufferSize)

Creates a new string buffer of a specified size

Параметры

BufferSize
The size of the string buffer to be allocated

Примечания

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

Параметры

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

Возвращаемое значение

Returns the extracted substring.


Substr(Start, Length)

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

Параметры

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)

Возвращаемое значение

Returns the extracted substring.


ToUpperCase()

Converts the string to upper case

Возвращаемое значение

Returns the string converted to upper case.


ToLowerCase()

Converts the string to lower case

Возвращаемое значение

Returns the string converted to lower case.


IndexOf(Substring, Starting)

Searches the string for a specified substring.

Параметры

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

Возвращаемое значение

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.

Параметры

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

Возвращаемое значение

Returns an Array object containing items of an original string.