6件ヒット
[1-6件を表示]
(0.040秒)
種類
- インスタンスメソッド (3)
- 特異メソッド (3)
ライブラリ
- ビルトイン (6)
検索結果
先頭5件
-
IO
. readlines(path , limit , chomp: false , opts={}) -> [String] (136273.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 = $ / , chomp: false , opts={}) -> [String] (136273.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 , chomp: false , opts={}) -> [String] (136273.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(limit , chomp: false) -> [String] (136237.0) -
データを全て読み込んで、その各行を要素としてもつ配列を返します。 既に EOF に達していれば空配列 [] を返します。
...@param chomp true を指定すると各行の末尾から rs を取り除きます。
@raise IOError 自身が読み込み用にオープンされていなければ発生します。
//emlist[例][ruby]{
IO.write("testfile", "line1,\nline2,\nline3,\n")
File.open("testfile") { |f| p f.readlines }......chomp = true)][ruby]{
IO.write("testfile", "line1,\rline2,\r\nline3,\n")
File.open("testfile") { |f| p f.readlines(chomp: true) } # => ["line1,\rline2,", "line3,"]
File.open("testfile") { |f| p f.readlines("\r", chomp: true) } # => ["line1,", "line2,", "\nline3,\n"]
//}
@see $/, IO#gets... -
IO
# readlines(rs = $ / , chomp: false) -> [String] (136237.0) -
データを全て読み込んで、その各行を要素としてもつ配列を返します。 既に EOF に達していれば空配列 [] を返します。
...@param chomp true を指定すると各行の末尾から rs を取り除きます。
@raise IOError 自身が読み込み用にオープンされていなければ発生します。
//emlist[例][ruby]{
IO.write("testfile", "line1,\nline2,\nline3,\n")
File.open("testfile") { |f| p f.readlines }......chomp = true)][ruby]{
IO.write("testfile", "line1,\rline2,\r\nline3,\n")
File.open("testfile") { |f| p f.readlines(chomp: true) } # => ["line1,\rline2,", "line3,"]
File.open("testfile") { |f| p f.readlines("\r", chomp: true) } # => ["line1,", "line2,", "\nline3,\n"]
//}
@see $/, IO#gets... -
IO
# readlines(rs , limit , chomp: false) -> [String] (136237.0) -
データを全て読み込んで、その各行を要素としてもつ配列を返します。 既に EOF に達していれば空配列 [] を返します。
...@param chomp true を指定すると各行の末尾から rs を取り除きます。
@raise IOError 自身が読み込み用にオープンされていなければ発生します。
//emlist[例][ruby]{
IO.write("testfile", "line1,\nline2,\nline3,\n")
File.open("testfile") { |f| p f.readlines }......chomp = true)][ruby]{
IO.write("testfile", "line1,\rline2,\r\nline3,\n")
File.open("testfile") { |f| p f.readlines(chomp: true) } # => ["line1,\rline2,", "line3,"]
File.open("testfile") { |f| p f.readlines("\r", chomp: true) } # => ["line1,", "line2,", "\nline3,\n"]
//}
@see $/, IO#gets...