Sha256: f7fb61a97e034568822a81107de93d4bb4cb9492b825725defc39c9f41bbd1fd
Contents?: true
Size: 479 Bytes
Versions: 7
Compression:
Stored size: 479 Bytes
Contents
class String # Left chomp. # # "help".lchomp("h") #=> "elp" # "help".lchomp("k") #=> "help" # # CREDIT: Trans def lchomp(match) if index(match) == 0 self[match.size..-1] else self.dup end end # In-place left chomp. # # "help".lchomp("h") #=> "elp" # "help".lchomp("k") #=> "help" # # CREDIT: Trans def lchomp!(match) if index(match) == 0 self[0...match.size] = '' self end end end
Version data entries
7 entries across 7 versions & 2 rubygems