Mid

Description

This function returns n characters from the string str$, starting at position StartPos. If the option n is omitted, then the function returns everything from StartPos.

Syntax

string Mid(string str$, int StartPos [, int n])$

Parameters

str$

is the string which you want to extract.

StartPos

is position from which to extract the characters.

n

Optional. Specifies the number of characters you want to extract. If n is not specified, then the remainder of the string, from StarPos, is extracted.

Return

Returns the extracted characters.

Examples

int n1=2; int n2=3;
string str$ = "aabcdef";
string strMid$ = Mid(str$,n1,n2)$;
strMid$ =; // returns "abc"
string str$ = "1/9/2014-1/18/2014"; 
int nn= Find(str$,"-")+1;  
string str2$ = Mid(str$,nn)$; 
str2$ =; // returns "1/18/2014"

See Also

Search Find Left Right Between