222件ヒット
[1-100件を表示]
(0.224秒)
クラス
- Array (8)
- FalseClass (55)
- String (19)
- Symbol (19)
- Time (121)
検索結果
先頭5件
-
Time
# sec -> Integer (26116.0) -
秒を整数で返します。
...秒を整数で返します。
//emlist[][ruby]{
p Time.mktime(2000, 1, 1).sec # => 0
//}
通常は0から59を返しますが、うるう秒の場合は60を返します。
//emlist[][ruby]{
ENV['TZ'] = 'right/UTC'
p Time.mktime(2005, 12, 31, 23, 59, 60).sec # => 60
//}... -
Array
# intersect?(other) -> bool (14103.0) -
other と共通の要素が少なくとも1個あれば true を、なければ false を返します。
...other と共通の要素が少なくとも1個あれば true を、なければ false を返します。
//emlist[例][ruby]{
a = [ 1, 2, 3 ]
b = [ 3, 4, 5 ]
c = [ 5, 6, 7 ]
a.intersect?(b) # => true
a.intersect?(c) # => false
//}... -
Array
# intersection(*other _ arrays) -> Array (14103.0) -
自身と引数に渡された配列の共通要素を新しい配列として返します。 要素が重複する場合は、そのうちの1つのみを返します。 要素の順序は自身の順序を維持します。
...合に発生します。
intersectionはObject#hashとObject#eql?を使って比較を行います。
//emlist[例][ruby]{
[1, 1, 3, 5].intersection([3, 2, 1]) # => [1, 3]
["a", "b", "z"].intersection(["a", "b", "c"], ["b"]) # => ["b"]
["a"].intersection......# => ["a"]
//}
@see Set#intersection, Array#&... -
String
# casecmp(other) -> -1 | 0 | 1 | nil (14103.0) -
String#<=> と同様に文字列の順序を比較しますが、 アルファベットの大文字小文字の違いを無視します。
...BcDeF".casecmp("abcde") #=> 1
"aBcDeF".casecmp("abcdef") #=> 0
"aBcDeF".casecmp("abcdefg") #=> -1
"abcdef".casecmp("ABCDEF") #=> 0
//}
nil は文字列のエンコーディングが非互換の時に返されます。
//emlist[][ruby]{
"\u{e4 f6 fc}".encode("ISO-8859-1").casecmp("\u{c4......String#casecmp? と違って大文字小文字の違いを無視するのは
Unicode 全体ではなく、A-Z/a-z だけです。
@param other self と比較する文字列
//emlist[例][ruby]{
"aBcDeF".casecmp("abcde") #=> 1
"aBcDeF".casecmp("abcdef") #=> 0
"aBcDeF".casecmp("abcdefg")......#=> -1
"abcdef".casecmp("ABCDEF") #=> 0
//}
nil は文字列のエンコーディングが非互換の時に返されます。
//emlist[][ruby]{
"\u{e4 f6 fc}".encode("ISO-8859-1").casecmp("\u{c4 d6 dc}") #=> nil
//}
@see String#<=>, Encoding.compatible?... -
String
# casecmp?(other) -> bool | nil (14103.0) -
大文字小文字の違いを無視し文字列を比較します。 文字列が一致する場合には true を返し、一致しない場合には false を返します。
...self と比較する文字列
//emlist[例][ruby]{
"abcdef".casecmp?("abcde") #=> false
"aBcDeF".casecmp?("abcdef") #=> true
"abcdef".casecmp?("abcdefg") #=> false
"abcdef".casecmp?("ABCDEF") #=> true
"\u{e4 f6 fc}".casecmp?("\u{c4 d6 dc}") #=> true
//}
nil は文字列のエンコ......ーディングが非互換の時に返されます。
//emlist[][ruby]{
"\u{e4 f6 fc}".encode("ISO-8859-1").casecmp?("\u{c4 d6 dc}") #=> nil
//}
@see String#casecmp... -
Symbol
# casecmp(other) -> -1 | 0 | 1 | nil (14103.0) -
Symbol#<=> と同様にシンボルに対応する文字列の順序を比較しますが、 アルファベットの大文字小文字の違いを無視します。
...較対象のシンボルを指定します。
//emlist[][ruby]{
:aBcDeF.casecmp(:abcde) #=> 1
:aBcDeF.casecmp(:abcdef) #=> 0
:aBcDeF.casecmp(:abcdefg) #=> -1
:abcdef.casecmp(:ABCDEF) #=> 0
:"\u{e4 f6 fc}".casecmp(:"\u{c4 d6 dc}") #=> 1
//}
other がシンボルではない場合や、......文字列のエンコーディングが非互換の場合は、nil を返します。
//emlist[][ruby]{
:foo.casecmp("foo") #=> nil
"\u{e4 f6 fc}".encode("ISO-8859-1").to_sym.casecmp(:"\u{c4 d6 dc}") #=> nil
//}
@see String#casecmp, Symbol#<=>, Symbol#casecmp?......ymbol#casecmp? と違って大文字小文字の違いを無視するのは
Unicode 全体ではなく、A-Z/a-z だけです。
@param other 比較対象のシンボルを指定します。
//emlist[][ruby]{
:aBcDeF.casecmp(:abcde) #=> 1
:aBcDeF.casecmp(:abcdef) #=> 0
:aBcDeF.casecmp(:abcd......efg) #=> -1
:abcdef.casecmp(:ABCDEF) #=> 0
:"\u{e4 f6 fc}".casecmp(:"\u{c4 d6 dc}") #=> 1
//}
other がシンボルではない場合や、文字列のエンコーディングが非互換の場合は、nil を返します。
//emlist[][ruby]{
:foo.casecmp("foo") #=> nil
"\u{e4 f6 fc}".encod......e("ISO-8859-1").to_sym.casecmp(:"\u{c4 d6 dc}") #=> nil
//}
@see String#casecmp, Symbol#<=>, Symbol#casecmp?... -
Symbol
# casecmp?(other) -> bool | nil (14103.0) -
大文字小文字の違いを無視しシンボルを比較します。 シンボルが一致する場合には true を返し、一致しない場合には false を返します。
...のシンボルを指定します。
//emlist[][ruby]{
:abcdef.casecmp?(:abcde) #=> false
:aBcDeF.casecmp?(:abcdef) #=> true
:abcdef.casecmp?(:abcdefg) #=> false
:abcdef.casecmp?(:ABCDEF) #=> true
:"\u{e4 f6 fc}".casecmp?(:"\u{c4 d6 dc}") #=> true
//}
other がシンボルではない......場合や、文字列のエンコーディングが非互換の場合は、nil を返します。
//emlist[][ruby]{
:foo.casecmp?("foo") #=> nil
"\u{e4 f6 fc}".encode("ISO-8859-1").to_sym.casecmp?(:"\u{c4 d6 dc}") #=> nil
//}
@see String#casecmp?, Symbol#casecmp... -
Time
# nsec -> Integer (14103.0) -
時刻のナノ秒の部分を整数で返します。
...Time.local(2000,1,2,3,4,5,6)
p "%10.9f" % t.to_f # => "946749845.000005960"
p t.nsec # => 6000
//}
IEEE 754 浮動小数点数で表現できる精度が違うため、Time#to_fの最小
の桁とnsecの最小の桁は異なります。nsecで表される値の方が正確です。... -
Time
# subsec -> Integer | Rational (14103.0) -
時刻を表す分数を返します。
...=> "946749845.000005960"
p t.subsec #=> (3/500000)
//}
to_f の値と subsec の値の下のほうの桁の値は異なる場合があります。
というのは IEEE 754 double はそれを表すのに十分な精度を
持たないからです。subsec で得られる値が正確で... -
Time
# tv _ nsec -> Integer (14103.0) -
時刻のナノ秒の部分を整数で返します。
...Time.local(2000,1,2,3,4,5,6)
p "%10.9f" % t.to_f # => "946749845.000005960"
p t.nsec # => 6000
//}
IEEE 754 浮動小数点数で表現できる精度が違うため、Time#to_fの最小
の桁とnsecの最小の桁は異なります。nsecで表される値の方が正確です。... -
Time
# tv _ usec -> Integer (14103.0) -
時刻のマイクロ秒の部分を整数で返します。
...時刻のマイクロ秒の部分を整数で返します。
//emlist[][ruby]{
t = Time.local(2000,1,2,3,4,5,6)
p "%10.6f" % t.to_f #=> "946749845.000006"
p t.usec #=> 6
//}...