c# remove carriage return and line feed 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');