Is there a method in Ruby that does the opposite String#succ
?
If you run succ
or next
you get this:
a = "4.4.10"
a.succ
=> "4.4.11"
I want the opposite:
a = "4.4.10"
a.previous
=> "4.4.09"
Is this possible? I was having a hard time finding this in the Ruby docs. Maybe it doesn't exist?
"sergio".next => "sergip"
"sergio!".next => "sergip!"
, although what OP seems to want is simple.