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"
Show source
Register or log in to add new notes.