Sha256: f022f00014a1139d881bb1c42d8aafd97f59c2cdac8ea30e8f23edcdb300d15f
Contents?: true
Size: 639 Bytes
Versions: 8
Compression:
Stored size: 639 Bytes
Contents
require_relative './shared' str = 'Lorem ipsum et dolorem' rx = /\s/ cs = CharacterSet.whitespace benchmark( caption: 'Removing whitespace', cases: { 'String#gsub' => -> { str.gsub(rx, '') }, 'CharacterSet#delete_in' => -> { cs.delete_in(str) }, } ) str = 'Lörem ipsüm ⛷ et dölörem' rx = /[\s\p{emoji}äüö]/ cs = CharacterSet.whitespace + CharacterSet.emoji + CharacterSet['ä', 'ö', 'ü'] benchmark( caption: 'Removing whitespace, emoji and umlauts', cases: { 'String#gsub' => -> { str.gsub(rx, '') }, 'CharacterSet#delete_in' => -> { cs.delete_in(str) }, } )
Version data entries
8 entries across 8 versions & 1 rubygems