るりまサーチ

最速Rubyリファレンスマニュアル検索!
143件ヒット [1-100件を表示] (0.014秒)
トップページ > クエリ:getbyte[x]

別のキーワード

  1. _builtin getbyte
  2. stringio getbyte
  3. io getbyte
  4. string getbyte
  5. strscan getbyte

ライブラリ

クラス

キーワード

検索結果

<< 1 2 > >>

ARGF.class#getbyte -> Integer | nil (18155.0)

self から 1 バイト(0..255)を読み込み整数として返します。 既に EOF に達していれば nil を返します。

...cho "bar" > file2
$ ruby argf.rb file1 file2

ARGF.getbyte # => 102
ARGF.getbyte # => 111
ARGF.getbyte # => 111
ARGF.getbyte # => 10
ARGF.getbyte # => 98
ARGF.getbyte # => 97
ARGF.getbyte # => 114
ARGF.getbyte # => 10
ARGF.getbyte # => nil

@see ARGF.class#getc, ARGF.class#gets...

String#getbyte(index) -> Integer | nil (18125.0)

index バイト目のバイトを整数で返します。

...定した場合は nil を返します。

@param index バイトを取り出す位置

//emlist[例][ruby]{
s = "tester"
s.bytes # => [116, 101, 115, 116, 101, 114]
s.getbyte(0) # => 116
s.getbyte(1) # => 101
s.getbyte(-1) # => 114
s.getbyte(6) # => nil
//}...

StringIO#getbyte -> Integer | nil (18119.0)

自身から 1 文字読み込んで、その文字に対応する Fixnum を返します。 文字列の終端に到達した時には nil を返します。

...字列の終端に到達した時には nil を返します。

@raise IOError 自身が読み取り不可なら発生します。

//emlist[例][ruby]{
require "stringio"
a = StringIO.new("ho")
a.getbyte #=> 104
a.getbyte #=> 111
a.getbyte #=> nil
//}...

IO#getbyte -> Integer | nil (18113.0)

IO から1バイトを読み込み整数として返します。 既に EOF に達していれば nil を返します。

...IO から1バイトを読み込み整数として返します。
既に EOF に達していれば nil を返します。

f = File.new("testfile")
f.getbyte #=> 84
f.getbyte #=> 104...

StringScanner#getbyte -> String | nil (15107.0)

1 バイトスキャンして文字列で返します。 スキャンポインタをその後ろに進めます。 スキャンポインタが文字列の末尾を指すなら nil を返します。

...ポインタをその後ろに進めます。
スキャンポインタが文字列の末尾を指すなら nil を返します。

StringScanner#getbyte は将来のバージョンで削除される予定です。
代わりに StringScanner#get_byte を使ってください。

//emlist[例][ruby]{...

絞り込み条件を変える

IO#ungetbyte(c) -> nil (6112.0)

指定したバイト列を書き戻します。

...し(IO#sysread など)
には影響しません。

@param c バイト列(文字列)、もしくは0から255までの整数

例:

f = File.new("testfile") #=> #<File:testfile>
b = f.getbyte #=> 0x38
f.ungetbyte(b) #=> nil
f.getbyte #=> 0x38...

StringIO#ungetbyte(char) -> nil (6100.0)

指定された char を読み戻します。

...指定された char を読み戻します。

2バイト以上の読み戻しは保証されません。

@param char 読み戻したい1文字かそのコードポイントを指定します。

@see IO#ungetbyte...

StringScanner#get_byte -> String | nil (7.0)

1 バイトスキャンして文字列で返します。 スキャンポインタをその後ろに進めます。 スキャンポインタが文字列の末尾を指すなら nil を返します。

...ポインタをその後ろに進めます。
スキャンポインタが文字列の末尾を指すなら nil を返します。

StringScanner#getbyte は将来のバージョンで削除される予定です。
代わりに StringScanner#get_byte を使ってください。

//emlist[例][ruby]{...

ARGF.class#getc -> String | nil (6.0)

self から 1 文字読み込んで返します。EOF に到達した時には nil を返します。

...foo" > file1
$ echo "bar" > file2
$ ruby argf.rb file1 file2

ARGF.getc # => "f"
ARGF.getc # => "o"
ARGF.getc # => "o"
ARGF.getc # => "\n"
ARGF.getc # => "b"
ARGF.getc # => "a"
ARGF.getc # => "r"
ARGF.getc # => "\n"
ARGF.getc # => nil

@see ARGF.class#getbyte, ARGF.class#gets...

ARGF.class#gets(limit) -> String | nil (6.0)

ARGFの現在位置から一行ずつ文字列として読み込みます。EOF に到達した時に は nil を返します。

...est.txt

# test.rb
ARGF.gets("e") # => "line"


例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets("") # => "line1\nline2\nline3\n\n"

@see Kernel.#gets, IO#gets, ARGF.class#getbyte, ARGF.class#getc...

絞り込み条件を変える

<< 1 2 > >>