Sha256: 81a663c4b250b94caea6e19f1eb511121a2f9017482334ce30bba197c4aa9522

Contents?: true

Size: 645 Bytes

Versions: 1

Compression:

Stored size: 645 Bytes

Contents

class String

  # Searches for the first occurrence of a delimiter, and returns the
  # portion of the String after that.  If the delimiter is not found,
  # returns nil.  Equivalent to <code>split(delimiter, 2).drop(1)[-1]</code>
  # for non-empty delimiters.
  #
  # @example
  #  "http://www.example.com".after("://")  # == "www.example.com"
  #  "http://www.example.com".after("?")    # == nil
  #  "http://www.example.com".after("")     # == "http://www.example.com"
  #
  # @param delimiter [String]
  # @return [String, nil]
  def after(delimiter)
    i = self.index(delimiter)
    i && self[i + delimiter.length, 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/after.rb