Get Common Words of Comma-separated Word Strings

Problem description & analysis

Below is Excel file words.xlsx:

hello,how,are,you,today

hello,I,am,doing,good,and,you

We are trying to get the common words of the two comma-separated word strings. Below is the expected result:

hello,you

Solution

Write the following script p1.dfx in esProc:

A

1

=file("words.xlsx").xlsopen()

2

=A1.xlscell("A1").split@c()

3

=A1.xlscell("A2").split@c()

4

=A2^A3

Explanation:

A1  Read data from the Excel file and return as an Excel object.

A2  Read value of cell A1 in the Excel file and split it into a sequence by comma.

A2  Read value of cell A2 in the Excel file and split it into a sequence by comma.

A4  Calculate the intersection of A2 and A3.

Read How to Call an SPL Script in Java to learn about the method of integrating a SPL script into a Java program.

Q & A Collection

https://stackoverflow.com/questions/62952242/compare-each-word-in-a-list-of-word-in-excel-with-list-of-words-java-vba-exc