Sprache: C#
Zählt wie oft ein String in einem String vorkommt.
// using System.Text.RegularExpressions;
private static int CountStrings(string str, string regexStr)
{
Regex regex = new Regex(regexStr);
return regex.Matches(str).Count;
}
// using System.Text.RegularExpressions;
private static int CountStrings(string str, string regexStr)
{
Regex regex = new Regex(regexStr);
return regex.Matches(str).Count;
}
Alte URL:
/snippet/zaehlt-wie-oft-ein-string-in-einem-string-vorkommt/558