SUPPORT THE SITE WITH A CLICK

Subscribe Rss:

SUPPORT THE SITE WITH A CLICK

Wednesday, September 23, 2009

Removing white spaces with squish method

Two new methods added to the String object, squish and squish!.


These methods do the same as strip method. It removes white spaces from the beginning and the end of the text. It also


removes unused white-spaces (multiple white-spaces) from the middle of the text Look the example:


“ A text full of spaces “.strip


#=> “A text full of spaces”


“ A text full of spaces


#=> “A text full of spaces”


No comments :

Post a Comment