Share via


TrimEnd Method

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Removes all trailing occurrences of a set of characters specified in an array from the current String object.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Function TrimEnd ( _
    ParamArray trimChars As Char() _
) As String
public string TrimEnd(
    params char[] trimChars
)
public:
String^ TrimEnd(
    ... array<wchar_t>^ trimChars
)
member TrimEnd : 
        trimChars:char[] -> string 
public function TrimEnd(
    ... trimChars : char[]
) : String

Parameters

  • trimChars
    Type: array<System. . :: . .Char> [] () [] []
    An array of Unicode characters to remove, or nullNothingnullptrunita null reference (Nothing in Visual Basic).

Return Value

Type: System. . :: . .String
The string that remains after all occurrences of the characters in the trimChars parameter are removed from the end of the current string. If trimChars is nullNothingnullptrunita null reference (Nothing in Visual Basic) or an empty array, Unicode white-space characters are removed instead.

Remarks

The TrimEnd method removes from the current string all trailing characters that are in the trimChars parameter. The trim operation stops when the first character that is not in trimChars is encountered at the end of the string. For example, if the current string is "123abc456xyz789" and trimChars contains the digits from "1" through "9", the TrimEnd method returns "123abc456xyz".

.NET Framework Security

See Also

Reference

String Class

System Namespace