Xbasic

FILTER_STRINGC Function

Syntax

String_Array[] as C = FILTER_STRINGC(C string ,C sub_string,[C delimiter[,L exclude]])

Arguments

string

A character string separated into "records" by the character string Delimiter.

sub_string

A character string to find in each "record" of the Input_List.

delimiter

A character string that separates the Input_List into multiple "records".

exclude

Logical. Optional. Default value = .F. (FALSE). .T.= The String_Array[] excludes the "records" that contain sub-string. .F. = The String_Array[] contains only the "records" that contain the Find_String.

Description

Filter in/out words that contain case sensitive sub_string from a list, default delimiter is CR-LF.

Discussion

FILTER_STRINGC() takes an Input_List that is divided into logical "records" by a Delimiter and either extracts or excludes the "records" that contain the Find_String characters anywhere within each "record" in the string. This function is typically used in Xbasic scripts. It is extremely useful for manipulating the CR-LF delimited strings that are returned by many of the Alpha Anywhere methods (such as A5.FORM_ENUM()).

Example

String = <<%a%
Red Ball
Green Ball
Yellow Bucket
Black Hat
%a%
filter_stringc(string, "Black", chr(13) + chr(10) ,.T.)
->   " Red Ball
Green Ball
Yellow Bucket"
filter_stringc(string, "black", chr(13) + chr(10) ,.T.)
->   " Red Ball
Green Ball
Yellow Bucket
Black Hat"

Limitations

The Find_String argument is case sensitive.

See Also