first(limit = 1)
public
Returns the first character of the string
or the first limit characters.
Examples:
"hello".first
"hello".first(2)
"hello".first(10)
# File activesupport/lib/active_support/core_ext/string/access.rb, line 41
def first(limit = 1)
if limit == 0
''
elsif limit >= size
self
else
mb_chars[0...limit].to_s
end
end