c# remove newline and carriage return from string code example
Example: remove carriage returns from string c#
// Remove newlines from both sides of the 'example' string variable
string cleaned = example.Trim('\r', '\n');
// Remove newlines from both sides of the 'example' string variable
string cleaned = example.Trim('\r', '\n');