るりまサーチ

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

別のキーワード

  1. openssl t61string
  2. asn1 t61string
  3. matrix t
  4. t61string new
  5. fiddle type_size_t

ライブラリ

モジュール

オブジェクト

キーワード

検索結果

<< 1 2 3 ... > >>

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

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

...mit 最大の読み込みバイト数


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

# test.rb
ARGF.gets # => "line1\n"

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

# test.rb
ARGF.gets(2...
...\n" > test.txt
# $ ruby test.rb test.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, AR...
...GF.class#getbyte, ARGF.class#getc...

ARGF.class#gets(limit, chomp: false) -> String | nil (24239.0)

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

...)。

@param limit 最大の読み込みバイト数

@param chomp true を指定すると各行の末尾から "\n", "\r", または "\r\n" を取り除きます。

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

# test.rb
ARGF.gets # =...
... test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets(2) # => "li"

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

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


例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.t...
...xt
# $ 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...

ARGF.class#gets(rs = $/) -> String | nil (24239.0)

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

...mit 最大の読み込みバイト数


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

# test.rb
ARGF.gets # => "line1\n"

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

# test.rb
ARGF.gets(2...
...\n" > test.txt
# $ ruby test.rb test.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, AR...
...GF.class#getbyte, ARGF.class#getc...

ARGF.class#gets(rs = $/, chomp: false) -> String | nil (24239.0)

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

...)。

@param limit 最大の読み込みバイト数

@param chomp true を指定すると各行の末尾から "\n", "\r", または "\r\n" を取り除きます。

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

# test.rb
ARGF.gets # =...
... test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets(2) # => "li"

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

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


例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.t...
...xt
# $ 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...

ARGF.class#gets(rs, limit) -> String | nil (24239.0)

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

...mit 最大の読み込みバイト数


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

# test.rb
ARGF.gets # => "line1\n"

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

# test.rb
ARGF.gets(2...
...\n" > test.txt
# $ ruby test.rb test.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, AR...
...GF.class#getbyte, ARGF.class#getc...

絞り込み条件を変える

ARGF.class#gets(rs, limit, chomp: false) -> String | nil (24239.0)

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

...)。

@param limit 最大の読み込みバイト数

@param chomp true を指定すると各行の末尾から "\n", "\r", または "\r\n" を取り除きます。

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

# test.rb
ARGF.gets # =...
... test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets(2) # => "li"

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

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


例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.t...
...xt
# $ 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...

Kernel.#gets(rs = $/) -> String | nil (24237.0)

ARGFから一行読み込んで、それを返します。 行の区切りは引数 rs で指定した文字列になります。

...
@return ファイルの終り(EOF)に到達した時、 nil を返します。
@raise Errno::EXXX 読み込みに失敗した場合に発生します。

//emlist[main.rb][ruby]{
ARGV << 'b.txt' << 'c.txt'
p gets #=> "hello\n"
p gets(nil) #=> "it\ncommon\n"
p gets("") #=> "ARGF\n\n"
p gets('、'...
...ct::ARGV を参照) をファイル名と\n# みなして、"
p gets #=> "それらのファイルを連結した 1 つの仮想ファイルを表すオブジェクトです。\n"
p gets #=> nil
p readline # end of file reached (EOFError)
//}

//emlist[b.txt][ruby]{
hello
it
common
//}

//emlist[c.t...
...xt][ruby]{
ARGF

# スクリプトに指定した引数 (Object::ARGV を参照) をファイル名と
# みなして、それらのファイルを連結した 1 つの仮想ファイルを表すオブジェクトです。
//}


@see $/,ARGF,Kernel.#readlines,Kernel.#readline...

Zlib::GzipReader#gets(rs = $/) -> String | nil (24229.0)

IO クラスの同名メソッドIO#getsと同じです。

...IO クラスの同名メソッドIO#getsと同じです。

但し、gzip ファイル中に
エラーがあった場合 Zlib::Error 例外や
Zlib::GzipFile::Error 例外が発生します。

gzip ファイルのフッターの処理に注意して下さい。
gzip ファイルのフッターに...
...合は
Zlib::GzipFile::NoFooter, Zlib::GzipFile::CRCError,
Zlib::GzipFile::LengthError 例外を発生させます。

* EOF (圧縮データの最後) を越えて読み込み要求を受けた時。
すなわち Zlib::GzipReader#read,
Zlib::GzipReader#gets メソッド等が nil を返...
...File::NoFooter Zlib::GzipFile::NoFooterを参照
@raise Zlib::GzipFile::CRCError Zlib::GzipFile::CRCErrorを参照
@raise Zlib::GzipFile::LengthError Zlib::GzipFile::LengthErrorを参照

require 'zlib'

=begin
# hoge.gz がない場合は下記で作成できる。
Zlib::GzipWriter.open('ho...

IO#gets(limit) -> String | nil (24215.0)

一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には nil を返します。

...作します。

読み込んだ文字列を変数 $_ にセットします。
IO#readline との違いは EOF での振る舞いのみです。

limit で最大の読み込みバイト数を指定します。ただし
ファイルのエンコーディングがマルチバイトエンコーディン...
...mit 最大の読み込みバイト数

@raise IOError 自身が読み込み用にオープンされていなければ発生します。

f = File.new("oneline_file")
f.gets #=> "This is line one\n"
$_ #=> "This is line one\n"
f.gets...

IO#gets(limit, chomp: false) -> String | nil (24215.0)

一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には nil を返します。

...作します。

読み込んだ文字列を変数 $_ にセットします。
IO#readline との違いは EOF での振る舞いのみです。

limit で最大の読み込みバイト数を指定します。ただし
ファイルのエンコーディングがマルチバイトエンコーディン...
...m limit 最大の読み込みバイト数
@param chomp true を指定すると各行の末尾から "\n", "\r", または "\r\n" を取り除きます。

@raise IOError 自身が読み込み用にオープンされていなければ発生します。

f = File.new("oneline_file")
f.gets...
...#=> "This is line one\n"
$_ #=> "This is line one\n"
f.gets #=> nil
$_ #=> nil

@see $/, IO#readline...

絞り込み条件を変える

IO#gets(rs = $/) -> String | nil (24215.0)

一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には nil を返します。

...作します。

読み込んだ文字列を変数 $_ にセットします。
IO#readline との違いは EOF での振る舞いのみです。

limit で最大の読み込みバイト数を指定します。ただし
ファイルのエンコーディングがマルチバイトエンコーディン...
...mit 最大の読み込みバイト数

@raise IOError 自身が読み込み用にオープンされていなければ発生します。

f = File.new("oneline_file")
f.gets #=> "This is line one\n"
$_ #=> "This is line one\n"
f.gets...

IO#gets(rs = $/, chomp: false) -> String | nil (24215.0)

一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には nil を返します。

...作します。

読み込んだ文字列を変数 $_ にセットします。
IO#readline との違いは EOF での振る舞いのみです。

limit で最大の読み込みバイト数を指定します。ただし
ファイルのエンコーディングがマルチバイトエンコーディン...
...m limit 最大の読み込みバイト数
@param chomp true を指定すると各行の末尾から "\n", "\r", または "\r\n" を取り除きます。

@raise IOError 自身が読み込み用にオープンされていなければ発生します。

f = File.new("oneline_file")
f.gets...
...#=> "This is line one\n"
$_ #=> "This is line one\n"
f.gets #=> nil
$_ #=> nil

@see $/, IO#readline...

IO#gets(rs, limit) -> String | nil (24215.0)

一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には nil を返します。

...作します。

読み込んだ文字列を変数 $_ にセットします。
IO#readline との違いは EOF での振る舞いのみです。

limit で最大の読み込みバイト数を指定します。ただし
ファイルのエンコーディングがマルチバイトエンコーディン...
...mit 最大の読み込みバイト数

@raise IOError 自身が読み込み用にオープンされていなければ発生します。

f = File.new("oneline_file")
f.gets #=> "This is line one\n"
$_ #=> "This is line one\n"
f.gets...

IO#gets(rs, limit, chomp: false) -> String | nil (24215.0)

一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には nil を返します。

...作します。

読み込んだ文字列を変数 $_ にセットします。
IO#readline との違いは EOF での振る舞いのみです。

limit で最大の読み込みバイト数を指定します。ただし
ファイルのエンコーディングがマルチバイトエンコーディン...
...m limit 最大の読み込みバイト数
@param chomp true を指定すると各行の末尾から "\n", "\r", または "\r\n" を取り除きます。

@raise IOError 自身が読み込み用にオープンされていなければ発生します。

f = File.new("oneline_file")
f.gets...
...#=> "This is line one\n"
$_ #=> "This is line one\n"
f.gets #=> nil
$_ #=> nil

@see $/, IO#readline...

StringIO#gets(rs = $/) -> String | nil (24213.0)

自身から 1 行読み込んで、その文字列を返します。文字列の終端に到達した時には nil を返します。 $_ に読み込んだ行がセットされます。

...ror 自身が読み込み用にオープンされていなければ発生します。

//emlist[例][ruby]{
require "stringio"
a = StringIO.new("hoge")
a.gets #=> "hoge"
$_ #=> "hoge"
a.gets #=> nil
$_ #=> nil
//}

@see $/...

絞り込み条件を変える

<< 1 2 3 ... > >>