1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/jcode.rb (String::tr_s): should have translated non

squeezing character sequence (i.e. a character) as well.  thanks
  to Hiroshi Ichikawa <gimite at gimite.ddo.jp> [ruby-list:42090]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10108 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2006-04-24 23:09:01 +00:00
parent 870eb33e6b
commit a115742968
2 changed files with 7 additions and 1 deletions

View file

@ -175,7 +175,7 @@ class String
def tr_s!(from, to)
return self.delete!(from) if to.length == 0
pattern = SqueezePatternCache[from] ||= /([#{_regex_quote(from)}])\1+/
pattern = SqueezePatternCache[from] ||= /([#{_regex_quote(from)}])\1*/
if from[0] == ?^
last = /.$/.match(to)[0]
self.gsub!(pattern, last)