Count number of keywords in string

Does anyone know how to get a number of occurrence of \n symbol in a string?

I have images OCRed by robot and now I want it to make decions depending on number of \n

image

thnx

1 Like

@kuzinyd Yes you can count by using Regex Count.

              assign str = "indra \n kumar \n country \n india"
              assign int v1 = System.Text.RegularExpressions.Regex.Matches(str,"\\n").Count

Now v1 will have count 3

Hope this will helps you.Let me know for any other query.

@indra

Did you happen to put two slashes unintendently ?

1 Like

@kuzinyd

Yes

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