Method: String#squeeze
- Defined in:
- string.c
#squeeze(*selectors) ⇒ Object
Returns a copy of self with characters specified by selectors “squeezed” (see Multiple Character Selectors):
“Squeezed” means that each multiple-character run of a selected character is squeezed down to a single character; with no arguments given, squeezes all characters:
"yellow moon".squeeze #=> "yelow mon"
" now is the".squeeze(" ") #=> " now is the"
"putters shoot balls".squeeze("m-z") #=> "puters shot balls"
8945 8946 8947 8948 8949 8950 8951 |
# File 'string.c', line 8945 static VALUE rb_str_squeeze(int argc, VALUE *argv, VALUE str) { str = str_duplicate(rb_cString, str); rb_str_squeeze_bang(argc, argv, str); return str; } |