Posted By

dotNetkow on 01/25/11


Tagged

String c#


Versions (?)

Remove carriage return, newline, and spaces from string


 / Published in: C#
 

Useful for detecting when a string is really empty.

  1. string result = "
  2. \n\n \r \n\n";
  3. result = result.TrimEnd('\r', '\n', ' ');
  4. // result = ""

Report this snippet  

You need to login to post a comment.