String::Trim Method (array<Char>)
Updated: April 2009
Removes all leading and trailing occurrences of a set of characters specified in an array from the current String object.
Assembly: mscorlib (in mscorlib.dll)
- Type: array<System::Char>
An array of Unicode characters to remove or nullptr.
The Trim method removes from the current string all leading and trailing characters that are in the trimChars parameter. Each leading and trailing trim operation stops when a character that is not in trimChars is encountered. For example, if the current string is "123abc456xyz789" and trimChars contains the digits from '1' through '9', the Trim method returns "abc456xyz".
This method does not modify the value of the current instance. Instead, it returns a new string in which all leading and trailing trimChars characters found in the current instance are removed.
For more information about which Unicode characters are categorized as white-space characters, see the Remarks section of the String::Trim() method overload.
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC, Xbox 360, Zune
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.