You could use String.Replace method
string str = "C Sharp";
str = str.Replace(" ", "");
or if you want to remove all whitespace characters (space, tabs, line breaks…)
string str = "C Sharp";
str = Regex.Replace(str, @"\s", "");
More Related Contents:
- Efficient way to remove ALL whitespace from String?
- How to replace multiple white spaces with one white space
- Fastest way to remove white spaces in string
- c# Fastest way to remove extra white spaces
- How to add one year to current year using DateTime [closed]
- how to get Value that cause exception
- How does native implementation of ValueType.GetHashCode work?
- WPF chart controls [closed]
- How can I get the assembly file version
- How to check if file exists on FTP before FtpWebRequest
- Why are C# 4 optional parameters defined on interface not enforced on implementing class?
- LINQ: combining join and group by
- How To Detect If Type is Another Generic Type
- Get List of Zero Reference Codes in Visual Studio
- Switch between dotnet core SDK versions
- What options are available for Shell32.Folder.GetDetailsOf(..,..)?
- What does |= (single pipe equal) and &=(single ampersand equal) mean
- Catching exceptions with “catch, when”
- Does the order of LINQ functions matter?
- Why I could not serialize a tuple in C#? [duplicate]
- AdaptiveTrigger and DataTemplate
- Smoothing a hand-drawn curve
- HTTPWebResponse + StreamReader Very Slow
- JSON.NET serialize JObject while ignoring null properties
- Is it possible to observe a partially-constructed object from another thread?
- Populate TreeView from DataBase
- Why static fields initialization occurs before the static constructor?
- Implementing Luhn algorithm using C#
- Authentication with PPK key in SSH.NET
- C# vs Python argument passing