Xbasic

WORD_SUBTRACTC Function

Syntax

New_List as C = WORD_SUBTRACTC(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 = CR-LF. A character string that separates words or entries.

Description

Returns Words (case sensitive) that are not in the exclude list.

Discussion

WORD_SUBTRACTC() 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 : For a case insensitive function, use WORD_SUBTRACT().

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

Limitations

The Find_Words argument is case sensitive.

See Also