Hi, I have two strings, 0017-Part and INV-0017 | P/O 9711,
I need to check if the second string contains any substring of the first string.
Iβll assume str1 = β0017-Partβ and str2 = βINV-0017 | P/O 9711β
You can do this within an if activity, or an assign activity (result is a boolean): str2.contains(str1)
Hi Dave,
so the thing is str2.contains(str1) will return false, but I need it to return true because 0017 is in both str1 and str2
Ok sorry I misunderstood. Do you have a predefined portion that you want to look at within str1? If not, you are going to find matches because str2 contains β0β,β1β,β7β,β-β,βPβ.
It seems like you want to match the β0017β portion though - is there a way that you can define how it will always appear? Is it always digits in the first part of the string? If so, you could use regex to pull out those digits only. Is it always going to be the first part preceding the β-β? If so, you could split the string by the β-β symbol, and take the first element in the array.
Either way, you want to determine how to pull out the substring from str1 that you actually want to search, then use that substring you pulled out to use the str2.contains(str1substring)
formula