How to count the number occurence of a string?

Hello,

I have a scrapped data such as: " as the 392 this is 11 the example of the 98 1 3 2"

I need to:

  1. Count the number occurence. In this case, 392, 11, 98, 1, 3 and 2 → no. numbers: 6
  2. Get the first number shown: 392

Thanks.

Use Matches activity using digit expression.

Hi,

Hope the following helps you.

  1. Count the number occurence. In this case, 392, 11, 98, 1, 3 and 2 → no. numbers: 6
System.Text.RegularExpressions.Regex.Matches(strData,"\d+").Count
  1. Get the first number shown: 392
System.Text.RegularExpressions.Regex.Matches(strData,"\d+")(0).Value

or

System.Text.RegularExpressions.Regex.Match(strData,"\d+").Value

Regards,

numberOccurences.xaml (6.2 KB)

@EngAnalyst

Thanks!

2 Likes

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