Click or drag to resize

ExtensionMethodsEnsureEnding Method

A quick way to make sure a string ends with another string

Namespace:  DustProductions.Core
Assembly:  DustProductions.Core (in DustProductions.Core.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
public static string EnsureEnding(
	this string str,
	string ending,
	bool ignoreCase = false
)

Parameters

str
Type: SystemString
The string to check
ending
Type: SystemString
The ending to make sure exists
ignoreCase (Optional)
Type: SystemBoolean
Optional parameter to ignore case for ending. Defaults false.

Return Value

Type: String
The string with the specified ending

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