Sha256: 01db95cd4479978789f9e4ea15b3e1d06c93a199ee7aff05721f3e8b80613fd7

Contents?: true

Size: 303 Bytes

Versions: 22

Compression:

Stored size: 303 Bytes

Contents

require 'facet/string/last_char'

class String
  # Returns first _n_ characters.
  #
  #   "Hello World".first_char(3)  #=> "Hel"
  #
  def first_char(n=1)
    slice(0, n.to_i)
  end
end


#  _____         _
# |_   _|__  ___| |_
#   | |/ _ \/ __| __|
#   | |  __/\__ \ |_
#   |_|\___||___/\__|
#
# TODO

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
facets-1.0.0 lib/facet/string/first_char.rb
facets-1.0.3 packages/core/lib/facet/string/first_char.rb
facets-1.3.0 lib/facets/core/string/first_char.rb
facets-1.1.0 lib/facet/string/first_char.rb
facets-1.2.0 lib/facets/core/string/first_char.rb
facets-1.2.1 lib/facets/core/string/first_char.rb
facets-1.3.3 lib/facets/core/string/first_char.rb
facets-1.3.2 lib/facets/core/string/first_char.rb
facets-1.3.1 lib/facets/core/string/first_char.rb
facets-1.4.0 lib/facets/core/string/first_char.rb
facets-1.4.1 lib/facets/core/string/first_char.rb
facets-1.4.2 lib/facets/core/string/first_char.rb
facets-1.4.3 lib/facets/core/string/first_char.rb
facets-1.4.4 lib/facets/core/string/first_char.rb
facets-1.4.5 lib/facets/core/string/first_char.rb
facets-1.7.30 lib/facets/core/string/first_char.rb
facets-1.7.38 lib/facets/core/string/first_char.rb
facets-1.7.0 lib/facets/core/string/first_char.rb
facets-1.7.46 lib/facets/core/string/first_char.rb
facets-1.8.20 lib/facets/core/string/first_char.rb