How can I count specific words in a string?

With get text activity I got a sentence(1 string variable), like this: “I have an apple. I would like to eat an apple. I like apple.” In this sentence I would like to count the “apple” word.

How can I count this “apple” word?

Thanks,
M.

this will give you the count, (txt = string variable)
System.Text.RegularExpressions.Regex.Split(txt, "apple").Length-1

image

Regex.Matches(str_rawString,“apple”).Count()

try with this

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.