Freigeben über


PackageUtilities.TrimSuffix Method

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.

Namespace:  Microsoft.VisualStudio.Shell
Assembly:  Microsoft.VisualStudio.Shell.12.0 (in Microsoft.VisualStudio.Shell.12.0.dll)

Syntax

'Declaration
<ExtensionAttribute> _
Public Shared Function TrimSuffix ( _
    s As String, _
    suffix As String, _
    stringComparision As StringComparison _
) As String
public static string TrimSuffix(
    this string s,
    string suffix,
    StringComparison stringComparision
)
[ExtensionAttribute]
public:
static String^ TrimSuffix(
    String^ s, 
    String^ suffix, 
    StringComparison stringComparision
)
static member TrimSuffix : 
        s:string * 
        suffix:string * 
        stringComparision:StringComparison -> string
public static function TrimSuffix(
    s : String, 
    suffix : String, 
    stringComparision : StringComparison
) : String

Parameters

  • s
    Type: String

    The string to be stripped of a suffix.

  • suffix
    Type: String

    The suffix to be stripped.

  • stringComparision
    Type: StringComparison

    Optional StringComparison specification. Defaults to case-insensitive.

Return Value

Type: String
The string without its suffix.

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).

.NET Framework Security

See Also

Reference

PackageUtilities Class

Microsoft.VisualStudio.Shell Namespace