Share via


PackageUtilities.TrimSuffix(String, String, StringComparison) Method

Definition

Removes a string suffix from a string and returns the remainder of the string. If the string does not end with the suffix, returns the original string unchanged.

public static string TrimSuffix (this string s, string suffix, StringComparison stringComparision = System.StringComparison.OrdinalIgnoreCase);
static member TrimSuffix : string * string * StringComparison -> string
<Extension()>
Public Function TrimSuffix (s As String, suffix As String, Optional stringComparision As StringComparison = System.StringComparison.OrdinalIgnoreCase) As String

Parameters

s
String

The string to be stripped of a suffix.

suffix
String

The suffix to be stripped.

stringComparision
StringComparison

Optional StringComparison specification. Defaults to case-insensitive.

Returns

The string without its suffix.

Applies to