Sha256: bddb09425e3b79f4b57b3003c8bbc78ce86ad31380a67de43ab3b6fc8a910794
Contents?: true
Size: 360 Bytes
Versions: 3
Compression:
Stored size: 360 Bytes
Contents
require 'facets/core/string/first_char' class String # Returns last _n_ characters. # # "Hello World".last_char(3) #=> "rld" # def last_char(n=1) n = n.to_i return self if n > size slice(-n, n) #self[-n..-1] end end # _____ _ # |_ _|__ ___| |_ # | |/ _ \/ __| __| # | | __/\__ \ |_ # |_|\___||___/\__| # # TODO
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
facets-1.8.49 | lib/facets/core/string/last_char.rb |
facets-1.8.51 | lib/facets/core/string/last_char.rb |
facets-1.8.54 | lib/facets/core/string/last_char.rb |