blob: 9b5266c58c79b3052076585fbc04578316381dec (
plain) (
tree)
|
|
require "active_support/multibyte"
class String
def at(position)
self[position]
end
def from(position)
self[position..-1]
end
def to(position)
self[0..position]
end
def first(limit = 1)
if limit == 0
''
elsif limit >= size
self
else
to(limit - 1)
end
end
def last(limit = 1)
if limit == 0
''
elsif limit >= size
self
else
from(-limit)
end
end
end
|