method

last

rails latest stable - Class: ActiveSupport::CoreExtensions::String::Access

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v2.3.8) is shown here.

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"