Trimming Strings


hi, have code:

static string trimwhitespace(string thestring) {     string result = "";     //remove whitespace chars string...     return result; }

i want trim whitespace off both ends of string. how can without using system.string.trim method?

thanks!!

p.s.  not know, whitespace characters include spaces (' '), newlines ('\n'), carriage returns ('\r'), tabs ('\t'), vetical tabs ('\v'), , form feeds ('\f'). please let me know if missing any.


nevin janzen (visit website)
if post answers question, please click propose answer. if post helpful, please click vote helpful.



var value = "with whitespace"; var chars = c in value c != ' ' select c; var newvalue = new string(chars.toarray()); // value "withwhitespace";



Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

Catalog Staging

How to Share webservice object to all user