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:
parent
870eb33e6b
commit
a115742968
2 changed files with 7 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Tue Apr 25 07:55:31 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* 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]
|
||||||
|
|
||||||
Tue Apr 25 00:08:24 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Tue Apr 25 00:08:24 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* regex.c (re_compile_pattern): should check if c is not a
|
* regex.c (re_compile_pattern): should check if c is not a
|
||||||
|
|
|
@ -175,7 +175,7 @@ class String
|
||||||
def tr_s!(from, to)
|
def tr_s!(from, to)
|
||||||
return self.delete!(from) if to.length == 0
|
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] == ?^
|
if from[0] == ?^
|
||||||
last = /.$/.match(to)[0]
|
last = /.$/.match(to)[0]
|
||||||
self.gsub!(pattern, last)
|
self.gsub!(pattern, last)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue