MID

Concept Link IconSee also

Return a sub-string of a character string.

WebVue support - Yes.

Syntax

StrVal = MID(Input, Start [, Num]);

Return type: STR.

Argument

Meaning

Input

The string to be manipulated. Type STR.

Start

The start position for the returned sub-string (0 denotes the first character position). Any numeric type.

Num

The number of characters in the returned sub-string. Any numeric type.

Execution

Returns Num characters from Input from the position defined by Start. If Num is omitted, or the remainder of the string is less than Num then the remainder of the string is returned.

Example

SUB Main()

DIM strChain1 as Str;

DIM strChain2 as Str;

DIM inti1 as Integer;

DIM inti2 as Integer;

 

inti1 = 7;

inti2 = 5;

strChain1 = "Hello, World!";

strChain2 = MID (strChain1,inti1,inti2); '5 characters from the 7th

Print("Return: ",strChain2);

'Display "Return: World"

END SUB