method

remove

v7.1.3.2 - Show latest stable - Class: String
remove(*patterns)
public

Returns a new string with all occurrences of the patterns removed.

str = "foo bar test"
str.remove(" test")                 # => "foo bar"
str.remove(" test", /bar/)          # => "foo "
str                                 # => "foo bar test"