Navigation:  MCL Reference > String Functions >

StrExtract( )

Print this Topic Previous pageReturn to chapter overviewNext page

A Visual FoxPro function which retrieves a string between two delimiters.

 

Syntax

StrExtract(cSearchExpressioncBeginDelim, [cEndDelim, [nOccurrence, [nFlag]]])

 

Argument

cSearchExpression

Specifies the string to search (If cBeginDelim is an empty string, the search is conducted from the beginning of cSearchExpression to the first occurrence of cEndDelim.)

cBeginDelim

Specifies the character that delimits the beginning of cSearchExpression.

cEndDelim

Specifies the character that delimits the end of cSearchExpression (If cEndDelim is an empty string, StrExtract( ) returns a string from nOccurrence of cBeginDelim to the end of cSearchExpression.)

nOccurrence

Specifies at which occurrence of cBeginDelim in cSearchExpression to start the extraction.

nFlag

Specify the type of controls placed on the search:

nFlag (additive)

Description

1

Case-insensitive search

2

End delimiter not required. Specifies that a search, which finds no occurrence of cEndDelim, returns the contents of cSearchExpression from the cBeginDelim location.

4

Include the delimiters in the returned expression

The default is a case sensitive search in which delimiters must be found (no nFlag value).

 

Returns

Character

 

Example

StrExtract('ABCDaATC','B','A')

Returns 'CDa'

 

StrExtract('ABCDaATC','b','a',1,1)

Returns 'CD'

 

StrExtract('ABCDaATC','a','c',2,1)

Returns 'AT'

 

StrExtract('ABCDaATC','b','k',1,3)

Returns 'CDaATC'

 

 


Page url: http://www.racematenet.com/english/help/index.html?strextract.htm