Mid (Substring within a String)

The Mid instruction is used to return a substring that is within a string.

Syntax

String = Mid ( SearchString, Start, Length )

Remarks

The Start and Length parameters are used to determine which part of the SearchString is returned. Regardless of the value of the Length parameter, the returned string is no longer than the original string.

Parameters

SearchString (Search String)

The string to evaluate.

Type: String or variable

Start

Specifies where in the SearchString to begin. A 1 indicates the first character in the string.

Type: Integer

If Start is beyond the current length of the string (first null), a null string is returned.

Length

Specifies the maximum number of characters returned from the original string.

Type: Integer

String variables can be declared as only one or two dimensions; for example, String(x) or String(x,y). To begin reading or modifying a string at a particular location into the string, enter the location as a third dimension; for example, String(x,y,n) where n is the desired character. For example, given an array of strings Str(10,10), Str(2,2,n) refers to n character in the (2,2) element of the array. Use Str(1,1,n) for a scalar variable and Str(x,1,n) for a one dimensional array element. 

NOTE: String functions are case sensitive. Uppercase or lowercase can be used to convert to all one case prior to processing the string if desired.