QMField()

Top  Previous  Next

 

The QMField() function extracts one or more components of a delimited string. It is analogous to the QMBasic FIELD() function.

 

 

Format

 

VBQMField(ByVal Src as String, ByVal Delimiter as String, ByVal Start as Long,

 Optional ByRef Occurrences as Long) as String

 

Cchar * QMField(char * Src, char * Delimiter, int Start, int Occurrences)

 

where

 

Srcis the string to be processed.

 

Delimiteris the single character delimiter separating components of the string.

 

Startis the number from one of the first component of Src to be returned.

 

Occurrencesis the number of delimited of components of Src to be returned. If omitted (VB only) or less than one, one component is returned.

 

 

The QMField() function returns the specified substring components of Src.

 

This function is evaluated on the client system and does not require a server connection to be open.

 

 

Examples

 

VB

FirstName = QMField(Name, " ", 1)

C

FirstName = QMField(Name, ' ', 1, 1);

 

The above example takes a variable Name holding a person's first and last names separated by a space and returns just their first name.

 

Note that the C example leaves variables FirstName pointing to a dynamically allocated memory area that must be released using QMFree() when no longer needed.