StringExt.GetOccurrenceCount Method

Gets the number of occurrences of a string in another string.

Namespace: UltimateXR.Extensions.System
Assembly: UltimateXR (in UltimateXR.dll) Version: 0.0.0.0

Syntax

C#

public static int GetOccurrenceCount(
	this string self,
	string key,
	bool caseSensitive = true
)

Parameters

 

self
Type: System.String
The string where to perform the search
key
Type: System.String
The string to find
caseSensitive (Optional)
Type: System.Boolean
Whether the search should be case sensitive

Return Value

Type: Int32
Number of occurrences of key in the source string

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type String. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also

Reference

StringExt Class
UltimateXR.Extensions.System Namespace