Sha256: 96673735dab39cbf80b8d369145352952250adebbc62391a260389ad7b83ec09

Contents?: true

Size: 500 Bytes

Versions: 1

Compression:

Stored size: 500 Bytes

Contents

class String

  # Drops characters from the beginning of the String, and returns the
  # remainder.  If the number of characters to drop is greater than the
  # length of the String, an empty string is returned.
  #
  # @example
  #   "abcdef".drop(0)  # == "abcdef"
  #   "abcdef".drop(3)  # == "def"
  #   "abcdef".drop(6)  # == ""
  #   "abcdef".drop(7)  # == ""
  #
  # @param n [Integer]
  # @return [String]
  def drop(n)
    return self.dup if n <= 0
    self[n, self.length] || ""
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
casual_support-3.0.2 lib/casual_support/string/drop.rb