summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authoreban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-03-04 09:46:08 +0000
committereban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-03-04 09:46:08 +0000
commitd08f28d839731cc4cc40181c88ee6db55b6975ee (patch)
treefcd915e9a7f8a83b44d7ff75695afa16457b5ada /string.c
parentb3902727d538d5a55cfbda245399f3e951dbc5aa (diff)
* string.c (trnext): support backslash escape in String#tr.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1226 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/string.c b/string.c
index 374dc86867..5bdc6d9fdd 100644
--- a/string.c
+++ b/string.c
@@ -1801,7 +1801,10 @@ trnext(t)
if (!t->gen) {
if (t->p == t->pend) return -1;
t->now = *(USTR)t->p++;
- if (t->p < t->pend - 1 && *t->p == '-') {
+ if (t->p < t->pend - 1 && *t->p == '\\') {
+ t->p++;
+ }
+ else if (t->p < t->pend - 1 && *t->p == '-') {
t->p++;
if (t->p < t->pend) {
if (t->now > *(USTR)t->p) {