mid
The mid function extracts from a specified position in a string, either to the end of the string or for a specified number of characters and returns the resultant string. This function is zero-based.
Common use
The mid function is often used with the strstr function. The strstr function will return the position of a specific character, then the mid can be used to return a substring from that character.
Because the mid function is zero-based, it is often used incorrectly, with the resultant string off by one character. An easy way to determine the correct starting position is to envision a cursor and count how many times you need to move it to get to the starting position you want. See the example below.
Syntax
string_variable = mid(string_variable,start_pos,num_char)where:
string_variable= The variable containing the string you want to extract.start_pos= The starting position in the string of characters (integer).num_char= The number of characters from the starting position (integer).
Note: You may not use an ActiveX property as the first parameter
of the mid function because the length of the property is unknown
prior to compilation.
Example
string [25]name;
string [10]temp_variable;
name = "Acme Shipping Company"
temp_variable = mid(name,5,8);
//The map will read 8 characters in the string starting with
//the sixth character. It is essentially ignoring the first
//five characters, so "temp_variable" will contain "Shipping".