3.5.7.2 Between

Description

This function extracts a substring using begin and end strings or characters.

Syntax

string Between(string str$, string str1$, string str2$)$

Parameter

str

Is a string or characters from which characters will be extracted.

str1, str2

Strings or characters between string str1 and string str2 will be extracted

Return

Returns the string contents after str1 and before str2. Returns an empty string if any of str, str1 or str2 are not found.

Example

EX1

string strIn$=[Results]"March 2009"!"Average Return"[1:31];
string strOut$ = Between(strIn$,"[","]")$;   // strOut is Results
string strOut$ = Between(strIn$,"]","!")$;   // strOut is "March 2009"
string strOut$ = Between(strIn$,"!","[")$;   // strOut is "Average Return"

EX2

string strIn$=[Graph1]1!2"W2P3_200um_multicycle_Measurement2.dat";
string strOut$=Between(strIn$,char(34)$,char(34)$)$;   // strOut is W2P3_200um_multicycle_Measurement2.dat

See Also

Mid Search Find Left Right