Sha256: 6e68cb2907ab3718a515cf33106dcd6bee57f6d34b79052852b41b850581325e

Contents?: true

Size: 455 Bytes

Versions: 1

Compression:

Stored size: 455 Bytes

Contents

class String

  # Searches for the last 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(delim, -1).drop(1)[-1]</code>.
  #
  # @param [String] delim delimiter to search for
  # @return [String] portion of the string after the last +delim+
  def after_last(delim)
    i = self.rindex(delim)
    i && self[i + delim.length, self.length]
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
casual_support-2.0.0 lib/casual_support/string/after_last.rb