Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

instance method

String#strip!

(*::String::selector) -> self?
strip!(*selectors) → self or nil

Like String#strip, except that:

  • Any modifications are made to self.

  • Returns self if any modification are made, nil otherwise.

Related: see Modifying.

See also #strip #sub #start_with? #sub! also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0