Skip to content

Instantly share code, notes, and snippets.

/string.c.doc Secret

Created December 20, 2012 01:04
Show Gist options
  • Save anonymous/27bc177e1ff6af0957fc to your computer and use it in GitHub Desktop.
Save anonymous/27bc177e1ff6af0957fc to your computer and use it in GitHub Desktop.
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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment