Trim function

  • Thread starter Thread starter SK
  • Start date Start date
SK said:
Trim function doesnt actually trim the spaces.Can anyone
help

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

My *guess* is that you think it changes the string you call it on - it
doesn't, as strings are immutable. Instead, it returns a new string
which is a trimmed version of the old string.
 
Thanks ....now it works
i was having something like the code below.
i assigend splitContent.Trim() to a string varibale and
used it.....it works fine

string splitContent = splitContentArray[index];
splitContent.Trim();
if (splitContent.Length > 0)
splittedContents.Add(splitContent);
 
Back
Top