るりまサーチ

最速Rubyリファレンスマニュアル検索!
33件ヒット [1-33件を表示] (0.032秒)
トップページ > クラス:IO[x] > ライブラリ:ビルトイン[x] > クエリ:lines[x] > 種類:特異メソッド[x]

別のキーワード

  1. _builtin lines
  2. io lines
  3. argf.class lines
  4. stringio lines
  5. string lines

検索結果

IO.readlines(path, limit, chomp: false, opts={}) -> [String] (6104.0)

path で指定されたファイルを全て読み込んで、その各行を要素としてもつ配列を返します。

...emlist[例][ruby]{
IO
.write("testfile", "line1\nline2,\nline3\n")
IO
.readlines("testfile") # => ["line1\n", "line2,\n", "line3\n"]
IO
.readlines("testfile", ",") # => ["line1\nline2,", "\nline3\n"]
//}

//emlist[例: rs を取り除く(chomp = true)][ruby]{
IO
.write("testfile",...
..."line1,\rline2,\r\nline3,\n")
IO
.readlines("testfile", chomp: true) # => ["line1,\rline2,", "line3,"]
IO
.readlines("testfile", "\r", chomp: true) # => ["line1,", "line2,", "\nline3,\n"]
//}...

IO.readlines(path, limit, opts={}) -> [String] (6104.0)

path で指定されたファイルを全て読み込んで、その各行を要素としてもつ配列を返します。

...、ファイルの読み込みに失敗した場合に発生します。

//emlist[例][ruby]{
IO
.write("testfile", "line1\nline2,\nline3\n")
IO
.readlines("testfile") # => ["line1\n", "line2,\n", "line3\n"]
IO
.readlines("testfile", ",") # => ["line1\nline2,", "\nline3\n"]
//}...

IO.readlines(path, rs = $/, chomp: false, opts={}) -> [String] (6104.0)

path で指定されたファイルを全て読み込んで、その各行を要素としてもつ配列を返します。

...emlist[例][ruby]{
IO
.write("testfile", "line1\nline2,\nline3\n")
IO
.readlines("testfile") # => ["line1\n", "line2,\n", "line3\n"]
IO
.readlines("testfile", ",") # => ["line1\nline2,", "\nline3\n"]
//}

//emlist[例: rs を取り除く(chomp = true)][ruby]{
IO
.write("testfile",...
..."line1,\rline2,\r\nline3,\n")
IO
.readlines("testfile", chomp: true) # => ["line1,\rline2,", "line3,"]
IO
.readlines("testfile", "\r", chomp: true) # => ["line1,", "line2,", "\nline3,\n"]
//}...

IO.readlines(path, rs = $/, opts={}) -> [String] (6104.0)

path で指定されたファイルを全て読み込んで、その各行を要素としてもつ配列を返します。

...、ファイルの読み込みに失敗した場合に発生します。

//emlist[例][ruby]{
IO
.write("testfile", "line1\nline2,\nline3\n")
IO
.readlines("testfile") # => ["line1\n", "line2,\n", "line3\n"]
IO
.readlines("testfile", ",") # => ["line1\nline2,", "\nline3\n"]
//}...

IO.readlines(path, rs, limit, chomp: false, opts={}) -> [String] (6104.0)

path で指定されたファイルを全て読み込んで、その各行を要素としてもつ配列を返します。

...emlist[例][ruby]{
IO
.write("testfile", "line1\nline2,\nline3\n")
IO
.readlines("testfile") # => ["line1\n", "line2,\n", "line3\n"]
IO
.readlines("testfile", ",") # => ["line1\nline2,", "\nline3\n"]
//}

//emlist[例: rs を取り除く(chomp = true)][ruby]{
IO
.write("testfile",...
..."line1,\rline2,\r\nline3,\n")
IO
.readlines("testfile", chomp: true) # => ["line1,\rline2,", "line3,"]
IO
.readlines("testfile", "\r", chomp: true) # => ["line1,", "line2,", "\nline3,\n"]
//}...

絞り込み条件を変える

IO.readlines(path, rs, limit, opts={}) -> [String] (6104.0)

path で指定されたファイルを全て読み込んで、その各行を要素としてもつ配列を返します。

...、ファイルの読み込みに失敗した場合に発生します。

//emlist[例][ruby]{
IO
.write("testfile", "line1\nline2,\nline3\n")
IO
.readlines("testfile") # => ["line1\n", "line2,\n", "line3\n"]
IO
.readlines("testfile", ",") # => ["line1\nline2,", "\nline3\n"]
//}...