11-27-2018 11:15 PM
Hi All
I have an application wherein I am trying to search StrA in StrB where StrA can be greater in length than StrB.
For Eg: StrA: Hot Bucket water spills.
StrB: New bucket
So I need to check if StrA any part is present in StrB. If the match is found then I will be doing further processing logic . I have checked with match pattern , regular expression, search/split functions , however not getting the expected output since StrA and StrB values can vary a lot. Also converting string to Array and then compare is not an option since these processing is only a initial part of application and needs much processing later.
I would like to implement a function which should be able to check if string one part is present in another string, then match should be found.
11-27-2018 11:50 PM
Match pattern is the faster string search. You can do as you said put it in a array and then in a for loop do the search. the for loop can execute in parallel multiple search and then you will have an array of Boolean or what ever you want as output. Then do the rest of the processing depending of the results.
Benoit
11-28-2018 06:17 AM
So you have StrA as a list of words you want to search for in StrB? If that is correct, then use Spreadsheet String To Array with a space as the delimiter to create a 1D array of strings (words). You can then use a FOR loop to perform the Match Pattern on each element. Turn on the conditional terminal and you can stop the FOR loop as soon as a match is found.
12-04-2018 04:44 PM
12-04-2018 07:00 PM
Where do the two strings come from? Is one static? It seems you want case insensitive match. Are there other delimiters besides space (comma, period, question mark, tab, double-space, etc.)?
Under some some scenarios, a variant attribute based solution might be best.
12-04-2018 09:15 PM
Hi LV_user1
Do you mean like this?
12-04-2018 10:56 PM
@hidayatmaulud wrote:
Hi LV_user1
Do you mean like this?
Seems extremely inefficient. For example if the two strings have very different word count, one will have many elements with empty strings. The middle code makes no sense because both array have the same number of elements guaranteed. The shift register in the second loop makes no sense because the content never changes.
Try to find a solution with 20% of the code. 🙂
12-04-2018 11:00 PM
Thank you for correcting me..
I'll improve my programming skill