
Untitled
By: a guest on
Apr 15th, 2012 | syntax:
None | size: 0.45 KB | hits: 7 | expires: Never
how to remove space in the middle using c#
name = name.Replace(" ","");
using System;
using System.Text.RegularExpressions;
class TestProgram
{
static string RemoveSpaces(string value)
{
return Regex.Replace(value, @"s+", " ");
}
static void Main()
{
string value = "Sunil Tanaji Chavan";
Console.WriteLine(RemoveSpaces(value));
value = "Sunil TanajirnChavan";
Console.WriteLine(RemoveSpaces(value));
}
}