Jump to content

Count occurrences of a substring: Difference between revisions

m
→‎{{header|C sharp}}: Remove unnecessary type annotation
m (→‎{{header|C sharp}}: Bug fix for null testString)
m (→‎{{header|C sharp}}: Remove unnecessary type annotation)
Line 494:
{
public static int CountSubStrings(this string testString, string testSubstring) =>
testString?.Split(new string[] { testSubstring }, StringSplitOptions.None)?.Length - 1 ?? 0;
}</lang>
 
Cookies help us deliver our services. By using our services, you agree to our use of cookies.