I have a need to get rid of all line breaks that appear in my strings (coming from db). I do it using code below:
value.Replace(\"\\r\\n\", \"\").Replace(\"\\n\"
personally i'd go with
public static String RemoveLineEndings(this String text) { StringBuilder newText = new StringBuilder(); for (int i = 0; i < text.Length; i++) { if (!char.IsControl(text, i)) newText.Append(text[i]); } return newText.ToString(); }