るりまサーチ

最速Rubyリファレンスマニュアル検索!
1件ヒット [1-1件を表示] (0.321秒)
トップページ > クエリ:ruby[x] > クエリ:String[x] > クラス:String[x] > クエリ:b[x] > 種類:インスタンスメソッド[x] > クエリ:append_as_bytes[x]

別のキーワード

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

ライブラリ

検索結果

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

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

...ist[例][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 U...
...TF-8 (Encoding::CompatibilityError)
//}

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

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