Find the number of string occurrences in another string(madskristensen.dk)
submitted by
madskristensen(8565) 5 years, 8 months ago
In C# 2.0 Microsoft introduces some new methods on the String class, one of them being Contains. The Contains method checks if a string in contained within another string in a case-sensitive way. It is very easy to use and a good addition to the String class. However, often you don’t want a case-sensitive search or you want to know how many times a particular string is contained within another.
Because the String class doesn’t provide us with such methods, we have to create our own. Here are three methods – two overloaded – that does just that.
|category: C#
|Views: 1
tags:
Tips another
Everyones tags:
Your Tags: