るりまサーチ

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

別のキーワード

  1. etc sc_xopen_enh_i18n
  2. rsa n
  3. rsa n=
  4. openssl n
  5. pop n_bytes

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

String#scan(pattern) {|s| ... } -> self (6246.0)

pattern がマッチした部分文字列をブロックに渡して実行します。 pattern が正規表現で括弧を含む場合は、 括弧で括られたパターンにマッチした文字列の配列を渡します。

...
pattern
がマッチした部分文字列をブロックに渡して実行します。
pattern
が正規表現で括弧を含む場合は、
括弧で括られたパターンにマッチした文字列の配列を渡します。

@param pattern 探索する部分文字列または正規表現

//em...
...list[例][ruby]{
"foobarbazfoobarbaz".scan(/ba./) {|s| p s }
# "bar"
# "baz"
# "bar"
# "baz"

"foobarbazfoobarbaz".scan("ba") {|s| p s }
# "ba"
# "ba"
# "ba"
# "ba"

"foobarbazfoobarbaz".scan(/(ba)(.)/) {|s| p s }
# ["ba", "r"]
# ["ba", "z"]
# ["ba", "r"]
# ["ba", "z"]
//}...

String#scan(pattern) -> [String] | [[String]] (6236.0)

self に対して pattern を繰り返しマッチし、 マッチした部分文字列の配列を返します。

...lf に対して pattern を繰り返しマッチし、
マッチした部分文字列の配列を返します。

pattern
が正規表現で括弧を含む場合は、
括弧で括られたパターンにマッチした部分文字列の配列の配列を返します。

@param pattern 探索する...
...{
p "foobar".scan(/../) # => ["fo", "ob", "ar"]
p "foobar".scan("o") # => ["o", "o"]
p "foobarbazfoobarbaz".scan(/ba./) # => ["bar", "baz", "bar", "baz"]

p "foobar".scan(/(.)/) # => [["f"], ["o"], ["o"], ["b"], ["a"], ["r"]]

p "foobarbazfoobarbaz".scan(/(ba)(.)/) # =>...

String#byteindex(pattern, offset = 0) -> Integer | nil (6232.0)

文字列の offset から右に向かって pattern を検索し、 最初に見つかった部分文字列の左端のバイト単位のインデックスを返します。 見つからなければ nil を返します。

...文字列の offset から右に向かって pattern を検索し、
最初に見つかった部分文字列の左端のバイト単位のインデックスを返します。
見つからなければ nil を返します。

引数 pattern は探索する部分文字列または正規表現で指定...
...

@param pattern 探索する部分文字列または正規表現
@param offset 探索を開始するバイト単位のオフセット

@raise IndexError オフセットが文字列の境界以外をさしているときに発生します。

//emlist[例][ruby]{
'foo'.byteindex('f') # =>...
....byteindex('o') # => 1
'foo'.byteindex('oo') # => 1
'foo'.byteindex('ooo') # => nil

'foo'.byteindex(/f/) # => 0
'foo'.byteindex(/o/) # => 1
'foo'.byteindex(/oo/) # => 1
'foo'.byteindex(/ooo/) # => nil

'foo'.byteindex('o', 1) # => 1
'foo'.byteindex('o', 2) # => 2
'foo'.byteindex('o', 3) # => nil

'...

String#byterindex(pattern, offset = self.bytesize) -> Integer | nil (6232.0)

文字列のバイト単位のインデックス offset から左に向かって pattern を探索します。 最初に見つかった部分文字列の左端のバイト単位のインデックスを返します。 見つからなければ nil を返します。

...インデックス offset から左に向かって pattern を探索します。
最初に見つかった部分文字列の左端のバイト単位のインデックスを返します。
見つからなければ nil を返します。

引数 pattern は探索する部分文字列または正規表...
...現で指定します。

offset が負の場合は、文字列の末尾から数えた位置から探索します。

byterindex と String#byteindex とでは、探索方向だけが逆になります。
完全に左右が反転した動作をするわけではありません。
探索はその開...
...[String#byteindex の場合][ruby]{
p "stringstring".byteindex("ing", 1) # => 3
# ing # ここから探索を始める
# ing
# ing # 右にずらしていってここで見つかる
//}

//emlist[String#byterindex の場合][ruby]{
p "stringstring".byterindex("ing", -...

String#index(pattern, pos = 0) -> Integer | nil (6232.0)

文字列のインデックス pos から右に向かって pattern を検索し、 最初に見つかった部分文字列の左端のインデックスを返します。 見つからなければ nil を返します。

...文字列のインデックス pos から右に向かって pattern を検索し、
最初に見つかった部分文字列の左端のインデックスを返します。
見つからなければ nil を返します。

引数 pattern は探索する部分文字列または正規表現で指定し...
...索します。

@param pattern 探索する部分文字列または正規表現
@param pos 探索を開始するインデックス

//emlist[例][ruby]{
p "astrochemistry".index("str") # => 1
p "regexpindex".index(/e.*x/, 2) # => 3
p "character".index(?c) #...
...=> 0

p "foobarfoobar".index("bar", 6) # => 9
p "foobarfoobar".index("bar", -6) # => 9
//}

@see String#rindex...
...=> 0

p "foobarfoobar".index("bar", 6) # => 9
p "foobarfoobar".index("bar", -6) # => 9
//}

@see String#rindex
@see String#byteindex...

絞り込み条件を変える

String#rindex(pattern, pos = self.size) -> Integer | nil (6232.0)

文字列のインデックス pos から左に向かって pattern を探索します。 最初に見つかった部分文字列の左端のインデックスを返します。 見つからなければ nil を返します。

...文字列のインデックス pos から左に向かって pattern を探索します。
最初に見つかった部分文字列の左端のインデックスを返します。
見つからなければ nil を返します。

引数 pattern は探索する部分文字列または正規表現で指...
...定します。

pos が負の場合は、文字列の末尾から数えた位置から探索します。

rindex と String#index とでは、探索方向だけが逆になります。
完全に左右が反転した動作をするわけではありません。
探索はその開始位置を右か...
...//emlist[String#index の場合][ruby]{
p "stringstring".index("ing", 1) # => 3
# ing # ここから探索を始める
# ing
# ing # 右にずらしていってここで見つかる
//}

//emlist[String#rindex の場合][ruby]{
p "stringstring".rindex("ing", -1) # =>...

Array#any?(pattern) -> bool (6216.0)

すべての要素が偽である場合に false を返します。 真である要素があれば、ただちに true を返します。

...ram pattern ブロックの代わりに各要素に対して pattern === item を評価します。

//emlist[例][ruby]{
p [1, 2, 3].any? {|v| v > 3 } # => false
p [1, 2, 3].any? {|v| v > 1 } # => true
p [].any? {|v| v > 0 } # => false
p %w[ant bear cat].any?(/d/) # => false
p [nil,...
...true, 99].any?(Integer) # => true
p [nil, true, 99].any? # => true
p [].any? # => false
//}

@see Enumerable#any?...

Array#none?(pattern) -> bool (6216.0)

ブロックを指定しない場合は、 配列のすべての 要素が偽であれば真を返します。そうでなければ偽を返します。

...します。

@param pattern ブロックの代わりに各要素に対して pattern === item を評価します。

//emlist[例][ruby]{
%w{ant bear cat}.none? {|word| word.length == 5} # => true
%w{ant bear cat}.none? {|word| word.length >= 4} # => false
%w{ant bear cat}.none?(/d/)...
...# => true
[].none? # => true
[nil].none? # => true
[nil,false].none? # => true
[nil, false, true].none? # => false
//}

@see Enumerable#none?...

Array#one?(pattern) -> bool (6216.0)

ブロックを指定しない場合は、 配列の要素のうち ちょうど一つだけが真であれば、真を返します。 そうでなければ偽を返します。

...します。

@param pattern ブロックの代わりに各要素に対して pattern === item を評価します。

//emlist[例][ruby]{
%w{ant bear cat}.one? {|word| word.length == 4} # => true
%w{ant bear cat}.one? {|word| word.length > 4} # => false
%w{ant bear cat}.one?(/t/)...
...# => false
[ nil, true, 99 ].one? # => false
[ nil, true, false ].one? # => true
[ nil, true, 99 ].one?(Integer) # => true
[].one? # => false
//}

@see Enumerable#one?...

Enumerable#any?(pattern) -> bool (6216.0)

すべての要素が偽である場合に false を返します。 真である要素があれば、ただちに true を返します。

...am pattern ブロックの代わりに各要素に対して pattern === item を評価します。

//emlist[例][ruby]{
require 'set'
p Set[1, 2, 3].any? {|v| v > 3 } # => false
p Set[1, 2, 3].any? {|v| v > 1 } # => true
p Set[].any? {|v| v > 0 } # => false
p Set['ant...
...', 'bear', 'cat'].any?(/d/) # => false
p Set[nil, true, 99].any?(Integer) # => true
p Set[nil, true, 99].any? # => true
p Set[].any? # => false
//}

@see Array#any?...

絞り込み条件を変える

Enumerable#none?(pattern) -> bool (6216.0)

ブロックを指定しない場合は、 Enumerable オブジェクトのすべての 要素が偽であれば真を返します。そうでなければ偽を返します。

...ブロックを指定しない場合は、 Enumerable オブジェクトのすべての
要素が偽であれば真を返します。そうでなければ偽を返します。

ブロックを指定した場合は、Enumerable オブジェクトのすべての要素を
ブロックで評価した結...
...m pattern ブロックの代わりに各要素に対して pattern === item を評価します。

//emlist[例][ruby]{
require 'set'
Set['ant', 'bear', 'cat'].none? {|word| word.length == 5} # => true
Set['ant', 'bear', 'cat'].none? {|word| word.length >= 4} # => false
Set['ant', 'bear', 'cat'].n...
...one?(/d/) # => true
Set[].none? # => true
Set[nil].none? # => true
Set[nil,false].none? # => true
Set[nil, false, true].none?...

Enumerable#one?(pattern) -> bool (6216.0)

ブロックを指定しない場合は、 Enumerable オブジェクトの要素のうち ちょうど一つだけが真であれば、真を返します。 そうでなければ偽を返します。

...ブロックを指定しない場合は、 Enumerable オブジェクトの要素のうち
ちょうど一つだけが真であれば、真を返します。
そうでなければ偽を返します。

ブロックを指定した場合は、Enumerable オブジェクトの要素を
ブロックで...
...m pattern ブロックの代わりに各要素に対して pattern === item を評価します。

//emlist[例][ruby]{
require 'set'
Set['ant', 'bear', 'cat'].one? {|word| word.length == 4} # => true
Set['ant', 'bear', 'cat'].one? {|word| word.length > 4} # => false
Set['ant', 'bear', 'cat'].one...
...?(/t/) # => false
Set[nil, true, 99].one? # => false
Set[nil, true, false].one? # => true
Set[nil, true, 99].one?(Integer) # => true
Set[].one?...
...lse
Set[nil, true, 99].one? # => false
Set[nil, true, false].one? # => true
Set[nil, true, 99].one?(Integer) # => true
Set[].one? # => false
//}

@see Array#one?...

Array#any? -> bool (6116.0)

すべての要素が偽である場合に false を返します。 真である要素があれば、ただちに true を返します。

...ram pattern ブロックの代わりに各要素に対して pattern === item を評価します。

//emlist[例][ruby]{
p [1, 2, 3].any? {|v| v > 3 } # => false
p [1, 2, 3].any? {|v| v > 1 } # => true
p [].any? {|v| v > 0 } # => false
p %w[ant bear cat].any?(/d/) # => false
p [nil,...
...true, 99].any?(Integer) # => true
p [nil, true, 99].any? # => true
p [].any? # => false
//}

@see Enumerable#any?...

Array#any? {|item| ... } -> bool (6116.0)

すべての要素が偽である場合に false を返します。 真である要素があれば、ただちに true を返します。

...ram pattern ブロックの代わりに各要素に対して pattern === item を評価します。

//emlist[例][ruby]{
p [1, 2, 3].any? {|v| v > 3 } # => false
p [1, 2, 3].any? {|v| v > 1 } # => true
p [].any? {|v| v > 0 } # => false
p %w[ant bear cat].any?(/d/) # => false
p [nil,...
...true, 99].any?(Integer) # => true
p [nil, true, 99].any? # => true
p [].any? # => false
//}

@see Enumerable#any?...
<< 1 2 3 ... > >>