last(limit = 1) public

Returns the last character of the string or the last limit characters.

Examples:

"hello".last     # => "o"
"hello".last(2)  # => "lo"
"hello".last(10) # => "hello"
Show source
Register or log in to add new notes.