Compartir a través de


PackageUtilities.TrimPrefix Method

Removes a string prefix from a string and returns the remainder of the string. If the string does not start with the prefix, 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 TrimPrefix ( _
    s As String, _
    prefix As String, _
    stringComparision As StringComparison _
) As String
public static string TrimPrefix(
    this string s,
    string prefix,
    StringComparison stringComparision
)
[ExtensionAttribute]
public:
static String^ TrimPrefix(
    String^ s, 
    String^ prefix, 
    StringComparison stringComparision
)
static member TrimPrefix : 
        s:string * 
        prefix:string * 
        stringComparision:StringComparison -> string
public static function TrimPrefix(
    s : String, 
    prefix : String, 
    stringComparision : StringComparison
) : String

Parameters

  • s
    Type: String

    The string to be stripped of a prefix.

  • prefix
    Type: String

    The prefix to be stripped.

  • stringComparision
    Type: StringComparison

    Optional StringComparison specification. Defaults to case-insensitive.

Return Value

Type: String
The string without its prefix.

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