Xbasic

WORD_SUBTRACT Function

Syntax

New_List as C = WORD_SUBTRACT(C Words,C Exclude_Words[,C Delimiter])

Arguments

Words

A CR-LF delimited list of words or entries to examine.

Exclude_Words

The word(s) to find.

Delimiter

Optional. Default = whitespace. A character string that separates words or entries.

Description

Returns Words that are not in the exclude list.

Discussion

WORD_SUBTRACT() removes all of the words or entries in Old_List from the list of words or entries in Find_Words. The words in Find_Words are separated by the CR-LF delimiter. This function is typically used in Xbasic programs to remove one list of CR-LF delimited words from another list of CR-LF delimited words. Note : WORD_SUBTRACT() is case insensitive. For a case sensitive function, use WORD_SUBTRACTC().

Example

dim list1 as C
dim list2 as C
dim list3 as C
biglist1=<<%a%
one two three four
%a%
biglist2 = <<%a%
one
two
three
four
%a%
removelist=<<%a%
one
two
%a%

In the first case, the delimiter of biglist1 is assumed to be a whitespace character, so the operation succeeds. In the second case, where the delimiter of biglist1 is specified to be CR-LF, the operation fails.

? word_subtract(biglist1, removelist)
= three four
? word_subtract(biglist1, removelist, crlf() )
= one two three four

In both cases the operation succeeds, because biglist2 is delimited by CR-LF characters.

? word_subtract(biglist2, removelist)
= three
four
? word_subtract(biglist2, removelist, crlf() )
= three
four

See Also