Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# remove spaces from string

string str = "This is a test";
str = str.Replace(" ", String.Empty);
// Output: Thisisatest
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 space between string in c#

string str = "C Sharp";
str = Regex.Replace(str, @"s", "");
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

PREVIOUS NEXT
Code Example
Csharp :: how to use file watcher in c# 
Csharp :: singleton unity 
Csharp :: unity new Color() 
Csharp :: c# LCP 
Csharp :: is keyboard clicked in Unity 
Csharp :: create char array c# 
Csharp :: how to move towards an object unity 
Csharp :: read input c# 
Csharp :: c# check if string is path or file 
Csharp :: print array in c# 
Csharp :: how to loop an animation in unity 
Csharp :: c# find duplicates in list of strings 
Csharp :: unity ignore collision between two objects 
Csharp :: c# get month number 
Csharp :: create material unity script 
Csharp :: c# linq select from object list 
Csharp :: default generic parameter for method in c# 
Csharp :: linux command line switch statement 
Csharp :: blazor onchange event not firing with inputselect 
Csharp :: get child of transform by index unity 
Csharp :: two variable in one loop c# 
Csharp :: unity time deltatime 
Csharp :: make string uppercase c# 
Csharp :: unity reverse string 
Csharp :: c# get type of object 
Csharp :: how to use the mouse scroll wheel to move the camera in unity 
Csharp :: c# enum to int array 
Csharp :: c# byte 
Csharp :: unity joystick movement 
Csharp :: wpf mouse over style trigger 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =