Categories: Tip Posted by okutbay on 16.02.2010 15:00 | Yorumlar (0)

Here is a very handy extension method to remove white spaces from strings.

    1 public static string RemoveWhiteSpace(this string TextToRemoveWhiteSpaces)

    2 {

    3     string pattern = "\\s+";

    4     string replacement = " ";

    5     string result = Regex.Replace(TextToRemoveWhiteSpaces, pattern, replacement);

    6     return result;

    7 }

Adapted from http://msdn.microsoft.com/en-us/library/xwewhkd1.aspx

Happy coding.

Bu yazıyı ilk değerlendiren siz olun

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Yorumlar

Yorum ekle


(Gravatar simgesini gösterecek)  

  Country flag

biuquote
  • Yorum
  • Canlı önizleme
Loading