From 172af01255da17cd53f235b330bb8bd8fd24ec29 Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 1 Jun 2011 22:29:09 +0000 Subject: Clarified String#tr rdoc. (RickHull) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- string.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'string.c') diff --git a/string.c b/string.c index 2691d85c66..0148d55be2 100644 --- a/string.c +++ b/string.c @@ -5228,19 +5228,22 @@ rb_str_tr_bang(VALUE str, VALUE src, VALUE repl) /* * call-seq: - * str.tr(from_str, to_str) -> new_str + * str.tr(from_str, to_str) => new_str * - * Returns a copy of str with the characters in from_str replaced - * by the corresponding characters in to_str. If to_str is - * shorter than from_str, it is padded with its last character. Both - * strings may use the c1--c2 notation to denote ranges of characters, and - * from_str may start with a ^, which denotes all - * characters except those listed. + * Returns a copy of str with the characters in from_str + * replaced by the corresponding characters in to_str. If + * to_str is shorter than from_str, it is padded with its last + * character in order to maintain the correspondence. * - * "hello".tr('aeiou', '*') #=> "h*ll*" - * "hello".tr('^aeiou', '*') #=> "*e**o" * "hello".tr('el', 'ip') #=> "hippo" + * "hello".tr('aeiou', '*') #=> "h*ll*" + * + * Both strings may use the c1-c2 notation to denote ranges of characters, + * and from_str may start with a ^, which denotes all + * characters except those listed. + * * "hello".tr('a-y', 'b-z') #=> "ifmmp" + * "hello".tr('^aeiou', '*') #=> "*e**o" */ static VALUE -- cgit v1.2.3