s = "The green hat is the twin of the green hat" h = Hash.new(0) s.split.each do |w| ...
class String
def strip chars = "\s"
gsub /^[#{chars}]+|[#{chars}}]+$/, ''
...
Ruby String#strip with char list
Better way?
s = "The green hat is the twin of the green hat" h = Hash.new(0) s.split.each do |w| ...
class String
def strip chars = "\s"
gsub /^[#{chars}]+|[#{chars}}]+$/, ''
...
Better way?
This is a coding question I...