CSharp examples for System:String Format
Clean Spaces from String
using System.Text.RegularExpressions; using System.Text; using System.Linq; using System.Globalization; using System;//from w w w .j a v a 2s . c om public class Main{ public static string CleanSpaces(this string text) { return CollapseSpace.Replace(text, " ").Trim(); } public static string Replace(this string text, int index, int length, string replacement) { text = text.Remove(index, length); text = text.Insert(index, replacement); return text; } }