Sha256: 96d08cc641e47839f22080a1b6d947a82fe559b00c1a1f6105416ebbbfec6dc9
Contents?: true
Size: 566 Bytes
Versions: 1
Compression:
Stored size: 566 Bytes
Contents
class String # Returns an array of characters. # # require 'facet/string/chars' # # "abc".chars #=> ["a","b","c"] # def chars self.split(//) end # Returns first n characters. # # require 'facet/string/first&last' # # "Hello World".first(3) #=> "Hel" # def first_chars(n=1) self.slice(0,n) end # Returns last n characters. # # require 'facet/string/first&last' # # "Hello World".last(3) #=> "rld" # def last_chars(n=1) return self if n > self.size self.slice(-n, n) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
facets-0.6.3 | lib/facet/string/chars.rb |