るりまサーチ

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

別のキーワード

  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 (6152.0)

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

...ch を書き戻します。

@param str_or_int 書き戻したい文字を文字列か整数で指定します。複数の文
字を書き戻す事もできます。

@raise IOError 自身が読み込み可能でない時に発生します。

//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 (120.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 が上の SEEK_SET, SEEK_CUR, SEEK_END 以外だった場合に発生します。...