method

first

v3.0.0 - Show latest stable - Class: String
first(limit = 1)
public

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

Examples:

  "hello".first     # => "h"
  "hello".first(2)  # => "he"
  "hello".first(10) # => "hello"