method

slice!

v1_8_7_72 - Show latest stable - Class: String
slice!(...)
public

Deletes the specified portion from str, and returns the portion deleted. The forms that take a Fixnum will raise an IndexError if the value is out of range; the Range form will raise a RangeError, and the Regexp and String forms will silently ignore the assignment.

   string = "this is a string"
   string.slice!(2)        #=> 105
   string.slice!(3..6)     #=> " is "
   string.slice!(/s.*t/)   #=> "sa st"
   string.slice!("r")      #=> "r"
   string                  #=> "thing"