Sign in | Join

Zack Owens

Showing how COOL .NET is!

This Blog

  • Home
  • Contact
  • About

Syndication

  • RSS
  • Atom
  • Comments RSS

Search

  • Go

Tags

    • .NET
    • AJAX
    • ASP.NET
    • ASP.NET MVC
    • ASP.NET Performance
    • ASP.NET Providers
    • C#
    • ClubStarterKit
    • Conversion
    • CSS
    • CSS Sprite
    • Fluent NHibernate
    • Functional Programming
    • IL
    • JavaScript
    • jQuery
    • Monads
    • Multi-tenancy
    • NHibernate
    • OneLine
    • Open Source
    • SubSonic
    • SubSonic Providers
    • Visual Basic
    • WebControl
    • Welcome

Navigation

  • Home
  • Blogs

Archives

  • January 2011 (2)
  • December 2010 (1)
  • June 2010 (3)
  • May 2010 (2)
  • January 2010 (2)
  • December 2009 (2)
  • October 2009 (1)
  • September 2009 (1)
  • August 2008 (1)
  • July 2008 (1)
  • June 2008 (1)
  • May 2008 (1)
  • April 2008 (2)
  • March 2008 (3)
  • February 2008 (2)
  • January 2008 (2)
  • December 2007 (2)
  • November 2007 (1)
  • October 2007 (3)
  • September 2007 (5)

General

  • EagleEnvision.NeT

June 2008 - Posts

Friday, June 27, 2008 2:37 PM

One-Line C# #1 : Remove Whitespace from a string

Thought I'd post a quick extension method that I made today. Hope it helps someone.

 

public static string RemoveWhitespace(this string str)
{
    try
    {
        return new Regex(@"\s*").Replace(str, string.Empty);
    }
    catch (Exception)
    {
        return str;
    }
}
Posted by zowens | 12 comment(s)
Filed under: .NET, IL, C#, OneLine
More Posts
 
Terms of Use