Xbasic

WORD_IN_COMMON Function

Syntax

Common_List as C = word_in_common(C list1 ,C list2 [,C delimiter ])

Arguments

word_in_common

The words found in both lists, separated by the delimiter string.

list1

A character string list of words.

list2

A character string list of words.

delimiter

Optional.Default = CR-LF. The character string that delimits words in each list.

Description

Find the words in common between two lists of words. Default delimiter is CRLF.

Discussion

Returns a list of words in common between List1 and List2. The words in List1 and List2 are separated by Delimiter. This function is typically used in Xbasic programs to find a list of CR-LF delimited words that two strings have in common.

Example 

The following Xbasic script defines two lists of CR-LF-delimited words, then finds the common words.

list1 = 
red
green
yellow
blue
purple
orange
%a%
list2 = 
red
orange
cyan
%a%
? word_in_common(list1, list2, crlf() )
= "red
orange"
dim a as C = "one,two,three,four"
dim b as C = "two,four"
? word_in_common(a, b, ",")
= "two,four"

See Also