String Summary

The following pages provide detailed information on the properties, methods and functions that are available to assist in manipulating String variables. Internally, Strings are implemented using much of the same structure and procedures as other built-in Classes. Therefore, in addition to providing classic Basic functions for operating on Strings, e.g. Len, String variable properties and methods are also available for performing many of the same operations.

A number of easy-to-use functions are provided for converting between String values and numerical values, e.g. CStr, CDbl, CInt, Hex .  Each of these built-in operations is described in the section on Functions. 

Table 19-95 summarizes the properties and methods of String variables that are described in greater detail in the following section.

Table 19-95: String Variables

Member Type Description

String.Compare

Method

Compares the values of two Strings in either a case sensitive or case insensitive manner.

string.IndexOf

Method

Searches for an exact match of a substring within the string variable and returns the starting position if found (0-n).

string.Length

Property

Returns the number of characters stored in a String variable.

string.Split

Method

Divides the string variable value into a series of substrings based upon a specified separator character and returns the array of substrings.

string.Substring

Method

Returns a substring of the string variable starting at a specific character position and with the specified length.

string.ToLower

Method

Returns a copy of the string with all lower case characters.

string.ToUpper

Method

Returns a copy of the string with all upper case characters.

string.Trim

Method

Trims off characters or white space from the start and end of a String variable value.

string.TrimEnd

Method

Trims off characters or white space from the end of a String variable value.

string.TrimStart

Method

Trims off characters or white space from the start of a String variable value.

 

Table 19-96 summarizes the String functions that are also described in greater detail in the subsequent section.

Table 19-96: String Functions

Function

Description

Asc (string)

Converts the first character of a String to its equivalent ASCII numerical code.

Chr (expression)

Given a numerical ASCII code, a String that consists of the equivalent ASCII character is returned.

Format (expression, format_s)

Converts a numerical value to a String value based upon a specified output format specification.

FromBitString (string, type, big_endian)

Extracts a number that has been packed in its internal bit format into a String and returns the value of the number.

Instr (start, string_t, string_s)

Searches for an exact match of a substring within a String expression and returns the starting position if found (1-n).

LCase (string)

Returns a String value that has been converted to lower case.

Len (string)

Returns the number of characters in a String.

Mid(string, first, length)

Returns a substring of the string starting at the first character position and consisting of length number of characters.

ToBitString (expression, type, big_endian)

Converts the value of an expression to a specific numeric type and returns the internal bit representation of the number packed into a String value.

UCase (string)

Returns a String value that has been converted to upper case.