business-intelligencebusiness-objects

Match multiple occurences of string A in string B?


Is there a way to match multiple occurrences of string A in string B? Match only returns a boolean and Pos only returns the index of the first match it finds.

Maybe split the string into an iterable array based on a common delimiter and return a count somehow?


Solution

  • Well this is one way to solve it. It's not pretty but it works.

    =(Length([stringB]) - Length(Replace([stringB];"stringA";""))) / Length("stringA")