Remove carriage return, newline, and spaces from string


/ Published in: C#
Save to your folder(s)

Useful for detecting when a string is <b>really</b> empty.


Copy this code and paste it in your HTML
  1. string result = "
  2. \n\n \r \n\n";
  3. result = result.TrimEnd('\r', '\n', ' ');
  4. // result = ""

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.