I'd like to try and find all the substring matches of two arrays

This is a contrived example of a larger problem



fullNames =: ('Joe B';'Joe Q';'Bobby Z';'Janet F')

shortNames =: ('Joe';'Bob';'Jane')

> fullNames

Joe B

Joe Q

Bobby Z

Janet F

> shortNames

Joe

Bob

Jane


I'd like a result of something like:


0

0

1

2



Indicating that Joe B matched Joe, Joe Q matched Joe, Bobby Z matched Bob
and Janet matched Jane



I struggled with E. for awhile seeing if I could get it to work


(,: > 0{ shortNames) E. (> fullNames)


1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

But I couldn't figure out how to build upon this for all shortNames

Thanks,

Joe
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to