Re: Getting last character from a string


#1

x[-1].chr

[tiger-ppc.gfbm:246]bystr> irb
irb(main):001:0> s = “abc”
=> “abc”
irb(main):002:0> s[-1]
=> 99
irb(main):003:0> s[-1].chr
=> “c”

irb(main):004:0>