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

* lib/jcode.rb (tr!, delete!, szueeze!): add empty string checking.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3602 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
eban 2003-03-23 13:24:45 +00:00
parent 31e2a889a0
commit 051eca3268
2 changed files with 6 additions and 1 deletions

View file

@ -1,3 +1,7 @@
Sun Mar 23 22:22:04 2003 WATANABE Hirofumi <eban@ruby-lang.org>
* lib/jcode.rb (tr!, delete!, szueeze!): add empty string checking.
Sun Mar 23 19:54:53 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* gc.c (rb_gc_call_finalizer_at_exit): use free() if dfree is -1.

View file

@ -130,7 +130,8 @@ class String
public
def tr!(from, to)
return self.delete!(from) if to.length == 0
return nil if from == ""
return self.delete!(from) if to == ""
pattern = TrPatternCache[from] ||= /[#{_regex_quote(from)}]/
if from[0] == ?^