last(limit = 1)
public
Returns the last
character of the string or the last
limit characters.
Examples:
"hello".last
"hello".last(2)
"hello".last(10)
# File activesupport/lib/active_support/core_ext/string/access.rb, line 53
def last(limit = 1)
(mb_chars[(-limit)..-1] || self).to_s
end