In a string I have hyphen
Provide please the syntax to count the no of hypen in a string
Thanks in advance
In a string I have hyphen
Provide please the syntax to count the no of hypen in a string
Thanks in advance
Assign activity:
Variable: hyphenCount (Integer)
Value:
yourString.Count(Function(c) c = “-”)
Hey @Ritaman_Baral
you can use:
numberOfHyphens = yourString.Count(Function(c) c = "-"c)
or
numberOfHyphens = yourString.Length - yourString.Replace("-", "").Length
or
numberOfHyphens = System.Text.RegularExpressions.Regex.Matches(yourString, "-").Count
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.