[DOC] Use unpack1 instead of unpack(template)[0] [ci skip]

This commit is contained in:
Kazuhiro NISHIYAMA 2021-09-23 09:20:00 +09:00
parent fb976df81f
commit e0c6e8c64a
No known key found for this signature in database
GPG key ID: 262ED8DBB4222F7A
3 changed files with 4 additions and 4 deletions

View file

@ -10831,7 +10831,7 @@ enc_str_scrub(rb_encoding *enc, VALUE str, VALUE repl, int cr)
*
* "abc\u3042\x81".scrub #=> "abc\u3042\uFFFD"
* "abc\u3042\x81".scrub("*") #=> "abc\u3042*"
* "abc\u3042\xE3\x80".scrub{|bytes| '<'+bytes.unpack('H*')[0]+'>' } #=> "abc\u3042<e380>"
* "abc\u3042\xE3\x80".scrub{|bytes| '<'+bytes.unpack1('H*')+'>' } #=> "abc\u3042<e380>"
*/
static VALUE
str_scrub(int argc, VALUE *argv, VALUE str)
@ -10853,7 +10853,7 @@ str_scrub(int argc, VALUE *argv, VALUE str)
*
* "abc\u3042\x81".scrub! #=> "abc\u3042\uFFFD"
* "abc\u3042\x81".scrub!("*") #=> "abc\u3042*"
* "abc\u3042\xE3\x80".scrub!{|bytes| '<'+bytes.unpack('H*')[0]+'>' } #=> "abc\u3042<e380>"
* "abc\u3042\xE3\x80".scrub!{|bytes| '<'+bytes.unpack1('H*')+'>' } #=> "abc\u3042<e380>"
*/
static VALUE
str_scrub_bang(int argc, VALUE *argv, VALUE str)