るりまサーチ

最速Rubyリファレンスマニュアル検索!
1件ヒット [1-1件を表示] (0.294秒)

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

クラス

検索結果

String#append_as_bytes(*objects) -> self (24238.0)

引数で与えたオブジェクトをバイト列として、self に破壊的に連結します。

...える場合は、最下位のバイトのみを使用します。

//emlist[例][ruby]{
s = "あ".b # => "\xE3\x81\x82"
s.encoding # => #<Encoding:BINARY (ASCII-8BIT)>
s.append_as_bytes("い") # => "\xE3\x81\x82\xE3\x81\x84"

# s << "い" では連結できない
s <...
...< "い" # => "incompatible character encodings: BINARY (ASCII-8BIT) and UTF-8 (Encoding::CompatibilityError)
//}

//emlist[引数で整数を渡す例][ruby]{
t = ""
t.append_as_bytes(0x61) # => "a"
t.append_as_bytes(0x3062) # => "ab"
//}

@
see String#<<, String#concat...