Get 2 last letters of a string and increased

how can i make the string “admin_X10-11_001” increased by 1 in order
to take “admin_x10-11_002”??

Thank you


Depending on how far you want to take it:

a = “admin_x10-11_001”
a.succ! # a = a.succ
a #=> “admin_x10-11_001”


“aby9”.succ # => “abz0”

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs