diff options
author | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-06-01 22:29:09 +0000 |
---|---|---|
committer | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-06-01 22:29:09 +0000 |
commit | 172af01255da17cd53f235b330bb8bd8fd24ec29 (patch) | |
tree | 8aff92829bdcdfbe7d6a9280518c88abaf3e2be1 /string.c | |
parent | ffe4aff8b3780c33a83a7591892b4d901e416911 (diff) | |
download | ruby-172af01255da17cd53f235b330bb8bd8fd24ec29.tar.gz |
Clarified String#tr rdoc. (RickHull)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 21 |
1 files changed, 12 insertions, 9 deletions
@@ -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 <i>str</i> with the characters in <i>from_str</i> replaced - * by the corresponding characters in <i>to_str</i>. If <i>to_str</i> is - * shorter than <i>from_str</i>, it is padded with its last character. Both - * strings may use the c1--c2 notation to denote ranges of characters, and - * <i>from_str</i> may start with a <code>^</code>, which denotes all - * characters except those listed. + * Returns a copy of <i>str</i> with the characters in <i>from_str</i> + * replaced by the corresponding characters in <i>to_str</i>. If + * <i>to_str</i> is shorter than <i>from_str</i>, 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 <i>from_str</i> may start with a <code>^</code>, which denotes all + * characters except those listed. + * * "hello".tr('a-y', 'b-z') #=> "ifmmp" + * "hello".tr('^aeiou', '*') #=> "*e**o" */ static VALUE |