Share This!

Wednesday, August 1, 2012

C#: Quickly Strip out all the Spaces from a String

This line of code will remove all spaces from a string.

string s="Some string with spaces";
string s2 = string.Join("",s.Split(' '));

...

Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

No comments:

Post a Comment

Contact Us

Name

Email *

Message *