Retain$

<< Click to Display Table of Contents >>

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

Retain$

 

Description

 

Return a string containing only the characters contained in a specified match string. All other characters are removed.

 

Syntax

 

s = Retain$(MainString, [ANY] MatchString)

 

Returns

 

String

 

Parameters

 

Name

Type

Optional

Meaning

MainString

String

No

String to search into

MatchString

String

No

String to search for

 

Remarks

 

Retain$ returns a string consisting of zero or more copies of the complete expression MatchString which are found in MainString. All other characters are removed.

If the ANY option is included, MatchString specifies a list of single characters to be retained, if they are found in MainString.

 

Restrictions

 

If MatchString is an empty string, Retain$ returns an empty string.

 

See also

 

String Handling,

 

Examples