Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# remove spaces from string

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

remove whitespace between string c#

string str = "C Sharp";
str = Regex.Replace(str, @"s", "");
Comment

c# remove spaces from string

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("")
		Console.WriteLine(newString);
		// Output: Thevalueis:99086.78
	}
}
Comment

how to remove white spaces from string in c#

using System.Linq;

// ...

string example = "   Hi there!    ";
string trimmed = String.Concat(example.Where(c => !Char.IsWhiteSpace(c)));
// Result: "Hithere!"
Comment

c# remove all whitespaces from string

string trim = Regex.Replace( text, @"s", "" );
Comment

how to remove all whitespace from a string in c#

  using System.Linq;

  ... 

  string source = "abc    	 def
789";
  string result = string.Concat(source.Where(c => !char.IsWhiteSpace(c)));

  Console.WriteLine(result);
Comment

PREVIOUS NEXT
Code Example
Csharp :: get file path in .net core from wwwroot folder 
Csharp :: limiting the amount of decimal places c# 
Csharp :: datetime month name 
Csharp :: how to chceck for a tag in a trigger enter 2d unity 
Csharp :: c# how to check for internet connectivity 
Csharp :: c# findindex 
Csharp :: Unity gameobject visible to specific camera 
Csharp :: c# convert long to int 
Csharp :: dictionary to list c# 
Csharp :: c# delete files in directory and subdirectories 
Csharp :: blazor ref to component in if 
Csharp :: unity gui style color button 
Csharp :: pyautopgui wrros on big sur 
Csharp :: quotes in string f# 
Csharp :: c# convert to nullable datetime 
Csharp :: string to char array c# 
Csharp :: get last index C# 
Csharp :: difference between awake and start unity 
Csharp :: vb.net read text file line by line 
Csharp :: c# loop through repeater items 
Csharp :: c# ternary operator 
Csharp :: c# Program to check if a given year is leap year 
Csharp :: unity get prefabs from folder 
Csharp :: check if mouse is in frame unity 
Csharp :: ignore ssl c# 
Csharp :: List C# add from List 
Csharp :: unity ui button 
Csharp :: C# linq mselect 
Csharp :: Save object to file C# 
Csharp :: c# create class from parent class 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =