Count the repeated character in string

hi everyone.
I need to check whether the string contains “@” more than 1 time.
Please help me to solve this.

Installer(.exe or .msi):

License type(Free, Trial/License code):

Studio/Robot version:

Current behavior:


You can check the count of @ with following statement:
YourStringVariable.Count(Function ( c ) c.Equals("@"))

Hi @soorya_prasad

  int cnt  = 0
  For Each c As Char In StringValue
    If c = "@" Then 
      cnt += 1
    End If
  Return cnt

Use this logic :slight_smile:

1 Like

Please try below:
Assign xValue = “a@b@c@d” As Generic Value
Count = xValue.Split("@").Length-1


Similar to @ppr 's response, I made a simple workflow that can be used to count the number of occurrences of a substring in a given string using Linq. It can also be used with a single character.CountSubstringOccurence.xaml (4.8 KB)

Hi @ppr is always showing the count as 0 for any variable.

@Owen_ACM thank you. it works perfectly.

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