class String
def first(limit = 1)
str.first(0) #=> ""
str.first(2) #=> "he"
str.first(1) #=> "h"
str.first #=> "h"
str = "hello"
given limit is greater than or equal to the string length, returns self.
from the beginning of the string until it reaches the limit value. If the
Returns the first character. If a limit is supplied, returns a substring
def first(limit = 1) if limit == 0 '' elsif limit >= size self else to(limit - 1) end end