PARSEF$

<< Click to Display Table of Contents >>

Navigation:  ThinBASIC Core Language > BuiltIn Functions > String functions >

PARSEF$

 

Description

 

FAST version of PARSE$ function working on scalar string variable only!

Return a delimited field from a string expression.

 

Syntax

 

s = PARSEF$(StringVariable, [ANY] StringDelimiter, Index)

 

Returns

 

String

 

Parameters

 

Name

Type

Optional

Meaning

StringVariable

Variable

No

IMPORTANT: a scalar string variable.

 

The string to be parsed.

If StringVariable is empty or contains no delimiter character(s), the string is considered to contain exactly one field. In this case, PARSECOUNT returns 1.

StringDelimiter

String

No

Contains delimiter character(s).  A delimiter is a character, list of characters, or string, that is used to mark the end of a field in StringVariable

 

If the ANY is used, StringVariable contains a set of characters, any of which may act as a delimiter character. If the ANY keyword is omitted, the entire StringVariablestring acts as a single delimiter. Delimiters are case-sensitive.

 

If StringVariable is an empty string, special rules apply.  The delimiter is assumed to be a comma.  Fields may optionally be enclosed in quotes.  Such quotes are considered as special field delimiters and are not returned as part of the result string.  Any characters that appear between a quote mark and the next comma delimiter character are discarded.  If no leading quote is found, any leading or trailing spaces are trimmed before the result string is returned.

Index

Numeric

No

The delimited field number to return.  The first field is 1.

The maximum number of fields contained in MainString can be determined with the PARSECOUNT function.

If Index is negative, parsing takes place from right to left.

 

Remarks

 

Restrictions

 

See also

 

String Handling,

 

Examples