Check out example codes for "c# remove spaces from string". It will help you in understanding the concepts better.

Code Example 1

string str = "This is a test";
str = str.Replace(" ", String.Empty);
// Output: Thisisatest

Code Example 2

using 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("")
		// Output: Thevalueis:99086.78

Learn ReactJs, React Native from