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 :: how to pass optional guid parameters in c# 
Csharp :: c# remove word from string 
Csharp :: round decimal two places 
Csharp :: calculate how much memory an object take c# 
Csharp :: c# for statement 
Csharp :: how to make button in asp.net to go to other page 
Csharp :: how to select time and date in datetimepicker in c# 
Csharp :: c# print decimal with zero at the end 
Csharp :: how to flip a character in unity 2d 
Csharp :: c# string enum 
Csharp :: list to array c# 
Csharp :: wpf toolbar disable overflow 
Csharp :: convert list of tuples to dictionary c# 
Csharp :: c# run batch file 
Csharp :: check an enum containa an int or not in C# 
Csharp :: c# kill one excel process 
Csharp :: how to chceck for a tag in a trigger enter 2d unity 
Csharp :: verify if number c# 
Csharp :: priority queue c# 
Csharp :: comments in c# 
Csharp :: how to concatenate two arrays in c# 
Csharp :: default parameter c# 
Csharp :: c# get classes which inherits 
Csharp :: C# fileinfo creation date 
Csharp :: stringify c# 
Csharp :: C# round number of digits after decimal point 
Csharp :: conditional if statement c# programming 
Csharp :: c# chunk array 
Csharp :: reverse linked list 
Csharp :: unity 2d enemy patrol script 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =