るりまサーチ (Ruby 3.0)

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

別のキーワード

  1. _builtin to_c
  2. etc sc_2_c_dev
  3. etc sc_2_c_bind
  4. tracer display_c_call
  5. tracer display_c_call=

ライブラリ

キーワード

検索結果

StringIO#ungetc(str_or_int) -> nil (18451.0)

文字列か整数で指定された str_or_int を自身に書き戻します。 nil を返します。

...ます。

//emlist[例][ruby]{
require "stringio"
s = StringIO.new("hoge")
s.pos = 1
s.ungetc("H")
p s.string # => "Hoge"
p s.pos # => 0

s = StringIO.new("hoge")
s.pos = 1
s.ungetc("H".ord)
p s.string # => "Hoge"
p s.pos # => 0

s = StringIO.new("hoge")
s.pos = 4
s.ungetc("HOGE")
p s...
....string # => "hogHOGE"
p s.pos # => 3

s = StringIO.new("hoge")
s.pos = 8
s.ungetc("A")
p s.string # => "hoge\000\000\000A"
p s.pos # => 7
//}...

StringIO#seek(offset, whence = IO::SEEK_SET) -> 0 (355.0)

自身の pos を whence の位置から offset バイトだけ移動させます。

自身の pos を whence の位置から offset バイトだけ移動させます。

@param offset 移動させたいバイト数を整数で指定します。

@param whence 以下のいずれかの定数を指定します。

* IO::SEEK_SET: ファイルの先頭から (デフォルト)
* IO::SEEK_CUR: 現在のファイルポインタから
* IO::SEEK_END: ファイルの末尾から

@raise Errno::EINVAL offset + whence がマイナスである場合に発生します。

@raise ArgumentError whence が上の SEE...