るりまサーチ

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

別のキーワード

  1. _builtin -
  2. open-uri open
  3. irb/input-method gets
  4. irb/input-method new
  5. matrix -

ライブラリ

キーワード

検索結果

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

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

...す。

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

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

//emlist[例][ruby]{
require "stringio"
s = StringIO.new("h...
....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 (3142.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 以外だった場合に発生します。...

StringIO#<<(obj) -> self (3124.0)

obj を pos の位置に書き込みます。 必要なら obj.to_s を呼んで 文字列に変換します。 self を返します。

...obj を pos の位置に書き込みます。 必要なら obj.to_s を呼んで
文字列に変換します。 self を返します。

@
param obj 自身に書き込みたい、文字列か to_s が定義されたオブジェクトを指定します。...