How to simplify the whitespaces in .NET System.String
kwiecień 20th, 2007 . by vipIf you’ve got “ some spaces here in string ”, and want only single spaces, you can use System.Text.RegularExpressions space.
The only line would give you only one space instead of many.
C#:
-
output = Regex.Replace(input, @”\s+”, ” “);
To remove spaces from the beggining and end, consider the String.Trim method.
Brak powiązanych wpisów

