Just Another Victim of the Ambient Morality wrote:
>     I'm actually hoping this is an embarrassing question but how do you get 
> the tail end of a string?  All I've figured out is this:
> 
using reg-ex

irb(main):102:0> "quick brown fox".scan /.$/
=> ["x"]

irb(main):103:0> "yo mama".scan /.$/
=> ["a"]


See Reg-ex section here: http://www.ruby-doc.org/docs/ProgrammingRuby/


You can convert the string into an array, and use Array.last and Array.pop 
methods to consume from the end

irb(main):090:0> letters = "quick brown fox".scan /./
=> ["q", "u", "i", "c", "k", " ", "b", "r", "o", "w", "n", " ", "f", "o", "x"]

irb(main):091:0> letters.last
=> "x"
irb(main):092:0> letters.pop
=> "x"

irb(main):093:0> letters.last
=> "o"
irb(main):094:0> letters.pop
=> "o"

irb(main):095:0> letters.last
=> "f"
irb(main):096:0> letters.pop
=> "f"

-- 
Kind Regards,
Rajinder Yadav

http://DevMentor.org

Do Good! - Share Freely, Enrich and Empower people to Transform their lives.