Sha256: db25f72f1957d97e42e5d0d8196f10b8434a91e452dc29e1a06abf760395a1be

Contents?: true

Size: 469 Bytes

Versions: 1

Compression:

Stored size: 469 Bytes

Contents

class String
  
  # Returns the portion of the string between the first occurrences of
  # an opening and a closing delimiter.  If either delimiter is not
  # found, returns nil.
  #
  # @param [String] open opening delimiter
  # @param [String] close closing delimiter
  # @return [String] portion of the string between the delimiters
  def between(open, close)
    i = self.index(open)
    j = self.index(close, i + 1) if i
    j && self[i + 1, j - i - 1]
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

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