From: WATANABE Hirofumi Date: 1997-11-03T00:00:25+09:00 Subject: [ruby-dev:788] [BUG] "".sub "", "" わたなべです. p("".sub "", "") の結果が "\000" になります. --- string.c.orig Wed Sep 24 18:16:08 1997 +++ string.c Sun Nov 2 16:00:00 1997 @@ -814,3 +814,3 @@ */ - str_cat(result, str->ptr+END(0), 1); + if (str->len) str_cat(result, str->ptr+END(0), 1); offset = END(0)+1; @@ -900,3 +900,3 @@ str_cat(result, RSTRING(val)->ptr, RSTRING(val)->len); - if (null) { + if (null && str->len) { str_cat(result, str->ptr+offset-1, 1);