Sha256: 5e4ad110eb053bf45af12a71bb91859e4e5ea67b091f76a6113cb521234cf906
Contents?: true
Size: 603 Bytes
Versions: 1
Compression:
Stored size: 603 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(delimiter, -1).drop(1)[-1]</code> # for non-empty delimiters. # # @example # "/path/to/file".after_last("/") # == "file" # "/path/to/file".after_last(".") # == nil # "/path/to/file".after_last("") # == "" # # @param delimiter [String] # @return [String, nil] def after_last(delimiter) i = self.rindex(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_last.rb |