るりまサーチ

最速Rubyリファレンスマニュアル検索!
377件ヒット [1-100件を表示] (0.185秒)

別のキーワード

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

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

String#chomp(rs = $/) -> String (21274.0)

self の末尾から rs で指定する改行コードを取り除いた文字列を生成して返します。 ただし、rs が "\n" ($/ のデフォルト値) のときは、 実行環境によらず "\r", "\r\n", "\n" のすべてを改行コードとみなして取り除きます。

...//emlist[例][ruby]{
p "foo\n".chomp # => "foo"
p "foo\n".chomp("\n") # => "foo"
p "foo\r\n".chomp("\r\n") # => "foo"

$/ = "\n" # デフォルト値と同じ
p "foo\r".chomp # => "foo"
p "foo\r\n".chomp # => "foo"
p "foo\n".chomp # => "foo"
p "foo\n\r".chomp # => "fo...
...o\n"

p "string\n".chomp(nil) # => "string\n"

p "foo\r\n\n".chomp("") # => "foo"
p "foo\n\r\n".chomp("") # => "foo"
p "foo\n\r\r".chomp("") # => "foo\n\r\r"
//}

@see String#chomp!
@see String#chop...
...o\n"

p "string\n".chomp(nil) # => "string\n"

p "foo\r\n\n".chomp("") # => "foo"
p "foo\n\r\n".chomp("") # => "foo"
p "foo\n\r\r".chomp("") # => "foo\n\r\r"
//}

@see String#chomp!
@see String#chop
@see String#delete_suffix...

Shell::Filter#tee(file) -> Shell::Filter (9207.0)

実行すると, それらを内容とする Filter オブジェクトを返します.

...lter オブジェクトを返します.

@param file シェルコマンドtee に与えるファイル名を文字列で指定します。

動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each { |file|
file.chomp!
cat...
...(file).each { |l|
echo(l) | tee(file + ".tee") >> "all.tee"
}
}
}...

String#chomp!(rs = $/) -> self | nil (9168.0)

self の末尾から rs で指定する改行コードを取り除きます。 ただし rs が "\n" ($/ のデフォルト値) のときは、 実行環境によらず "\r", "\r\n", "\n" のすべてを改行コードとみなして取り除きます。

...@return chomp! は通常 self を返しますが、取り除く改行がなかった場合は nil を返します。

//emlist[例][ruby]{
buf = "string\n"
buf.chomp! # => nil
p buf # => "string"

$/ = "\n" # デフォルトと同じ
p "foo\r".chomp! # => "foo"
p "foo\r\n".chomp! # =>...
..."foo"
p "foo\n".chomp! # => "foo"
p "foo\n\r".chomp! # => "foo\n"

buf = "string\n"
buf.chomp!(nil) # => nil
p buf # => "string\n"

p "foo\r\n\n".chomp!("") # => "foo"
p "foo\n\r\n".chomp!("") # => "foo"
p "foo\n\r\r".chomp!("") # => nil
//}

@see String#chomp
@see String#chop!...
....chomp! # => "foo"
p "foo\n\r".chomp! # => "foo\n"

buf = "string\n"
buf.chomp!(nil) # => nil
p buf # => "string\n"

p "foo\r\n\n".chomp!("") # => "foo"
p "foo\n\r\n".chomp!("") # => "foo"
p "foo\n\r\r".chomp!("") # => nil
//}

@see String#chomp
@see String#chop!
@see String#delet...

ARGF.class#gets(limit, chomp: false) -> String | nil (6210.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 = $/, chomp: false) -> String | nil (6210.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, chomp: false) -> String | nil (6210.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...

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

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

...作します。

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

limit で最大の読み込みバイト数を指定します。ただし
ファイルのエンコーディングがマルチバイトエンコーディン...
...am 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 = $/, chomp: false) -> String | nil (6210.0)

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

...作します。

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

limit で最大の読み込みバイト数を指定します。ただし
ファイルのエンコーディングがマルチバイトエンコーディン...
...am 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, chomp: false) -> String | nil (6210.0)

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

...作します。

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

limit で最大の読み込みバイト数を指定します。ただし
ファイルのエンコーディングがマルチバイトエンコーディン...
...am 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...

Shell#tee(file) -> Shell::Filter (6207.0)

実行すると, それらを内容とする Filter オブジェクトを返します.

...lter オブジェクトを返します.

@param file シェルコマンドtee に与えるファイル名を文字列で指定します。

動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each { |file|
file.chomp!
cat...
...(file).each { |l|
echo(l) | tee(file + ".tee") >> "all.tee"
}
}
}...

絞り込み条件を変える

Shell::CommandProcessor#tee(file) -> Shell::Filter (6207.0)

実行すると, それらを内容とする Filter オブジェクトを返します.

...lter オブジェクトを返します.

@param file シェルコマンドtee に与えるファイル名を文字列で指定します。

動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each { |file|
file.chomp!
cat...
...(file).each { |l|
echo(l) | tee(file + ".tee") >> "all.tee"
}
}
}...

Shell#cat(*files) -> Shell::Filter (6107.0)

実行すると, それらを内容とする Filter オブジェクトを返します.

...Filter オブジェクトを返します.

@param files シェルコマンド cat に与えるファイル名を文字列で指定します。

動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each { |file|
file.chomp!...
...cat(file).each { |l|
echo(l) | tee(file + ".tee") >> "all.tee"
}
}
}...

Shell::CommandProcessor#cat(*files) -> Shell::Filter (6107.0)

実行すると, それらを内容とする Filter オブジェクトを返します.

...Filter オブジェクトを返します.

@param files シェルコマンド cat に与えるファイル名を文字列で指定します。

動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each { |file|
file.chomp!...
...cat(file).each { |l|
echo(l) | tee(file + ".tee") >> "all.tee"
}
}
}...
<< 1 2 3 ... > >>