Still by VisualMode
Home Blogmarks TILs Consulting
Home Blogmarks TILs Consulting
← Back to all TILs

Squeeze Out The Extra Space

ruby Written April 30, 2015

Remove all the excess spaces from a string using the squeeze method:

> "this  is   a string".squeeze(' ')
=> "this is a string"

Other posts like this

  • Tabs To Spaces vim
  • Splitting On Whitespace clojure
  • Add Comments To Regex With Free-Spacing ruby
  • Insert A Non-Breaking Space Character mac
  • Limit Split ruby