Xbasic

WORD_SUBTRACTC Function

Syntax

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

Arguments

WordsCharacter

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

Exclude_WordsCharacter

The word(s) to find.

DelimiterCharacter

Default = whitespace (e.g. a space, tab, or CR-LF character). A character string that separates words or entries.

Returns

New_ListCharacter

Returns all words not included in the exclude list.

Description

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

Discussion

WORD_SUBTRACTC() removes all of the words or entries in a list of of words using a case-sensitive comparison. The words to remove are defined as a CR-LF delimited list. The WORD_SUBTRACTC() function is typically to remove one list of CR-LF delimited words from another list of CR-LF delimited words.

For case-insensitive comparisons, use WORD_SUBTRACT().

dim list1 as c =<<%str%
ONE two THREE four
%str%

dim list2 as c =<<%str%
one
TWO
three
FOUR
%str%

dim removelist as c =<<%str%
one
two
three
four
%str%

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

? word_subtractc(list1, removelist)
= ONE THREE

? word_subtractc(list1, removelist, crlf())
= ONE two THREE four

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

? word_subtractc(list2, removelist)
= TWO
FOUR

? word_subtractc(list2, removelist, crlf())
= TWO
FOUR

See Also