string class : Trim(string) method

Description

Returns a string that removed specified characters at the beginning and end of the caller.

Syntax

stringInstance.Trim(string charList)

Arguments

ClassNameDescription
stringcharListCharacters to remove.

Return value

ClassDescription
stringA string that removed specified characters at the beginning and end.

Sample code

1:

string org = "abcbcDDDDDDcbabb";

2:

string result = org.Trim("abc"); // result is "DDDDDD".

It is not "abc" that was deleted. 'a', 'b', and 'c' were removed.

Notes

The individual characters in the argument string are removed regardless of their appearance order.

Links for reference

None

Copyright © Rice All rights reserved.