Saturday, March 31, 2012

Trim whitespace (start and end) of string

Just wondering how you can trim the whitespace of a string for the start and end of it.


e.g. " My String "

Thanks!

nothing more then string.trim(); put the string value in a string variable.

greets,

Erdem


Here are the methods available to you

publicstring Trim(paramschar[] trimChars);

publicstring Trim();

publicstring TrimStart(paramschar[] trimChars);

publicstring TrimEnd(paramschar[] trimChars);


Hi,

try this

String myString = " My String ";

myString.Trim(' ');

Regards

0 comments:

Post a Comment