squeeze(*args) public

Builds a set of characters from the other_str parameter(s) using the procedure described for String#count. Returns a new string where runs of the same character that occur in this set are replaced by a single character. If no arguments are given, all runs of identical characters are replaced by a single character.

"yellow moon".squeeze                  #=> "yelow mon"
"  now   is  the".squeeze(" ")         #=> " now is the"
"putters shoot balls".squeeze("m-z")   #=> "puters shot balls"
Show source
Register or log in to add new notes.
October 9, 2010
6 thanks

Be Advised

Also may convert original string into Jamaican.

e.g.

"green moon".squeeze  #=> "gren mon"
November 12, 2013
0 thanks

Be aware

Be aware

'John    Doe №88'.sqeeze 
=> 'John Doe №8' # with just one '8'