c# remove spaces from string
string str = "This is a test";
str = str.Replace(" ", String.Empty);
// Output: Thisisatestusing System;
using System.Text.RegularExpressions;
public class Program
{
public static void Main()
{
string yourString = "The value is: 99 086.78";
string newString = ""; // MUST set the Regex result to a variable for it to take effect
newString = Regex.Replace(yourString, @"\s+", ""); //Replaces all(+) space characters (\s) with empty("")
Console.WriteLine(newString);
// Output: Thevalueis:99086.78
}
}
Also in C#:
- c# find process by name
- c# razor add disabled to button if
- array c#
- csharp first element of array
- asp.net core task iactionresult
- add row count devepxress report
- c# ref
- c# delegate return value invoke
- c# quaternion eular calculator
- unity html get request
- c# access session in class
- serilog loglevel order
- C# .net core convert string to enum
- c sharp tryparse
- disable mouse unity
- convert array object to int[] c#
- what type of variable is true or false in c#
- c# build string out of list of strings
- can't add an editor script
- change z value unity
- unity access child
- unity how to change rotation
- download and run exe c# 1 button