I’ve been using text.indexof() to see if a string is located inside another string, however is it it possible to do a case sensitive/insensitive search option? I’ve been looking around Google and not having much luck with it.
A huge bonus would be if it could count the number of occurrences inside the string!
There are several overloads of
IndexOfthat take aStringComparisonparameter, allowing you to specify the various culture and case-sensitivity options.For example:
As for counting occurrences, there’s nothing built-in, but it’s pretty straightforward to do it yourself: