Skip to content

Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

String#reverse

() -> ::String
reverse → string

Returns a new string with the characters from self in reverse order.

Example
'stressed'.reverse # => "desserts"

Ruby version changes

  1. 3.0
See also #reverse! #replace #prepend #rindex also in 4.1 · 4.0 · 3.3 · 3.2 · 3.1 · 3.0