mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 08:33:58 +02:00
[DOC] Use unpack1
instead of unpack(template)[0]
[ci skip]
This commit is contained in:
parent
fb976df81f
commit
e0c6e8c64a
3 changed files with 4 additions and 4 deletions
4
string.c
4
string.c
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue