Answers for "remove space and newline from string c#"

C#
10

c# remove spaces from string

string str = "This is a test";
str = str.Replace(" ", String.Empty);
// Output: Thisisatest
Posted by: Guest on April-22-2020
0

c# remove newline from string

// Remove all newlines from the 'example' string variable
string cleaned = example.Replace("\n", "").Replace("\r", "");
Posted by: Guest on August-04-2020

Code answers related to "remove space and newline from string c#"

C# Answers by Framework

Browse Popular Code Answers by Language