HelpersExtensionsNthIndexOf Method |
Finds index of nth occurrence of string.
Namespace: CMS.HelpersAssembly: CMS.Helpers (in CMS.Helpers.dll) Version: 9.0.0
Syntax public static int NthIndexOf(
this string str,
string value,
int n,
bool fromBegining
)
Parameters
- str
- Type: SystemString
String to examine - value
- Type: SystemString
String to find - n
- Type: SystemInt32
Number determining index of which occurrence to return - fromBegining
- Type: SystemBoolean
Whether to search from beginning or end
Return Value
Type:
Int32If found, returns an index of the nth occurrence. Otherwise returns -1.
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