What is the easiest way in C# to trim a newline off of a string? -


I want to make sure that _content does not end with a newLine character:

 < Code> _content = Sb.ToString (). Trim (new four [] {environment. Newline});  

But the code above does not work because the trim does not have overloaded parameters for the collection of stars, only characters are.

What is the simple one-liner to remove an environment from the end of a string?

does the following for me.

  sb.ToString (). TrimEnd ('\ r', '\ n');  

or

  sb.ToString (). TrimEnd (EnvironmentalNewLine.ToCharArray ());  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -