Sha256: 5d2f881bd92e70adaf6756dab6ba4c33d051a79c0891f69d3e457cf75623273f
Contents?: true
Size: 455 Bytes
Versions: 22
Compression:
Stored size: 455 Bytes
Contents
unless String.method_defined? :remove class String # Removes all occurrences of a pattern in a string. # # @return [String] a new string without any occurrences of the pattern. def remove(pattern) dup.remove!(pattern) end # Removes all occurrences of a pattern in a string. # # @return [String] the string without any occurrences of the pattern. def remove!(pattern) gsub!(pattern, '') end end end
Version data entries
22 entries across 19 versions & 6 rubygems