るりまサーチ

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

別のキーワード

  1. _builtin to_i
  2. fiddle to_i
  3. matrix elements_to_i
  4. csv to_i
  5. matrix i

オブジェクト

検索結果

<< 1 2 3 ... > >>

Prime::PseudoPrimeGenerator#each_with_index {|prime, index| ... } -> self (27530.0)

与えられたブロックに対して、素数を0起点の連番を渡して評価します。

...を返します。 ブロックを与えられなかった場合は Enumerator を返します。

//emlist[例][ruby]{
require 'prime'
Prime::EratosthenesGenerator.new(10).each_with_index do |prime, index|
p [prime, index]
end
# [2, 0]
# [3, 1]
# [5, 2]
# [7, 3]
//}

@see Enumerator#with_index...

Prime::PseudoPrimeGenerator#each_with_index -> Enumerator (27430.0)

与えられたブロックに対して、素数を0起点の連番を渡して評価します。

...を返します。 ブロックを与えられなかった場合は Enumerator を返します。

//emlist[例][ruby]{
require 'prime'
Prime::EratosthenesGenerator.new(10).each_with_index do |prime, index|
p [prime, index]
end
# [2, 0]
# [3, 1]
# [5, 2]
# [7, 3]
//}

@see Enumerator#with_index...

Psych::Parser::Mark#index -> Integer (27301.0)

先頭からの文字数。

先頭からの文字数。

Hash#index(val) -> object (27231.0)

値 val に対応するキーを返します。対応する要素が存在しない時には nil を返します。

...
nil を返します。

該当するキーが複数存在する場合、どのキーを返すかは不定です。

H
ash#index は obsolete です。
使用すると警告メッセージが表示されます。

@param val 探索に用いる値を指定します。

//emlist[例][ruby]{
h
= {:ab...
...=> "some" , :cd => "all" , :ef => "all"}

p h.key("some") #=> :ab
p h.key("all") #=> :cd
p h.key("at") #=> nil
//}

@see Hash#invert...

CSV::Row#index(header, minimum_index = 0) -> Integer (24720.0)

与えられたヘッダの名前に対応するインデックスを返します。

...m header ヘッダの名前を指定します。

@param minimum_index このインデックスより後で、ヘッダの名前を探します。
重複しているヘッダがある場合に便利です。

//emlist[例][ruby]{
require "csv"

row = CSV::Row.new(["header1", "he...
...ader2", "header1"], [1, 2, 3])
row.index("header1") # => 0
row.index("header1", 1) # => 2
//}

@see CSV::Row#field...

絞り込み条件を変える

Enumerable#each_with_index(*args) {|item, index| ... } -> self (24645.0)

要素とそのインデックスをブロックに渡して繰り返します。

...ith_index は offset 引数を受け取りますが、
each_with_index は受け取りません (引数はイテレータメソッドにそのまま渡されます)。

@param args イテレータメソッド (each など) にそのまま渡されます。

//emlist[例][ruby]{
[5, 10, 15].each_with...
..._index do |n, idx|
p [n, idx]
end
# => [5, 0]
# [10, 1]
# [15, 2]
//}

//emlist[引数ありの例][ruby]{
require 'stringio'
StringIO.new("foo|bar|baz").each_with_index("|") do |s, i|
p [s, i]
end
# => ["foo|", 0]
# ["bar|", 1]
# ["baz", 2]
//}

@see Enumerator#with_index...

Enumerable#each_with_index(*args) -> Enumerator (24445.0)

要素とそのインデックスをブロックに渡して繰り返します。

...ith_index は offset 引数を受け取りますが、
each_with_index は受け取りません (引数はイテレータメソッドにそのまま渡されます)。

@param args イテレータメソッド (each など) にそのまま渡されます。

//emlist[例][ruby]{
[5, 10, 15].each_with...
..._index do |n, idx|
p [n, idx]
end
# => [5, 0]
# [10, 1]
# [15, 2]
//}

//emlist[引数ありの例][ruby]{
require 'stringio'
StringIO.new("foo|bar|baz").each_with_index("|") do |s, i|
p [s, i]
end
# => ["foo|", 0]
# ["bar|", 1]
# ["baz", 2]
//}

@see Enumerator#with_index...

Prime::PseudoPrimeGenerator#with_index {|prime, index| ... } -> self (24430.0)

与えられたブロックに対して、素数を0起点の連番を渡して評価します。

...を返します。 ブロックを与えられなかった場合は Enumerator を返します。

//emlist[例][ruby]{
require 'prime'
Prime::EratosthenesGenerator.new(10).each_with_index do |prime, index|
p [prime, index]
end
# [2, 0]
# [3, 1]
# [5, 2]
# [7, 3]
//}

@see Enumerator#with_index...

Matrix#each_with_index(which = :all) -> Enumerator (24408.0)

行列の各要素をその位置とともに引数としてブロックを呼び出します。

...which で処理する要素の範囲を指定することができます。
Matrix#each と同じなのでそちらを参照してください。

ブロックを省略した場合、 Enumerator を返します。

//emlist[例][ruby]{
require 'matrix'
Matrix[ [1,2], [3,4] ].each_with_index do |e,...
...row, col|
puts "#{e} at #{row}, #{col}"
end
# => 1 at 0, 0
# => 2 at 0, 1
# => 3 at 1, 0
# => 4 at 1, 1
//}

@param which どの要素に対してブロックを呼び出すのかを Symbol で指定します
@see Matrix#each...

Matrix#each_with_index(which = :all) {|e, row, col| ... } -> self (24408.0)

行列の各要素をその位置とともに引数としてブロックを呼び出します。

...which で処理する要素の範囲を指定することができます。
Matrix#each と同じなのでそちらを参照してください。

ブロックを省略した場合、 Enumerator を返します。

//emlist[例][ruby]{
require 'matrix'
Matrix[ [1,2], [3,4] ].each_with_index do |e,...
...row, col|
puts "#{e} at #{row}, #{col}"
end
# => 1 at 0, 0
# => 2 at 0, 1
# => 3 at 1, 0
# => 4 at 1, 1
//}

@param which どの要素に対してブロックを呼び出すのかを Symbol で指定します
@see Matrix#each...

絞り込み条件を変える

<< 1 2 3 ... > >>