how to eliminate spaces in string c# code example
Example 1: c# remove spaces from string
string str = "This is a test";
str = str.Replace(" ", String.Empty);
// Output: Thisisatest
Example 2: c# remove all whitespaces from string
string trim = Regex.Replace( text, @"s", "" );