22件ヒット
[1-22件を表示]
(0.059秒)
検索結果
先頭4件
-
Kernel
. # Integer(arg , base = 0) -> Integer (31.0) -
引数を整数(Fixnum,Bignum)に変換した結果を返します。
...eger(4) #=> 4
p Integer(4_000) #=> 4000
p Integer(9.88) #=> 9
p Integer(nil) # can't convert nil into Integer (TypeError)
p Integer(Object.new) # cannot convert Object into Integer (TypeError)
p Integer("10") #=> 10
p Integer("10", 2) #=> 2
p Integer("0d10")......teger("1\n0") # `Integer': invalid value for Integer: "1\n0" (ArgumentError)
p Integer("hoge") # `Integer': invalid value for Integer: "hoge" (ArgumentError)
p Integer("") # `Integer': invalid value for Integer: "" (ArgumentError)
//}
@see String#hex,String#oct,String#to_i,Integer... -
Kernel
. # Integer(arg , base = 0 , exception: true) -> Integer | nil (31.0) -
引数を整数(Fixnum,Bignum)に変換した結果を返します。
...eger(4) #=> 4
p Integer(4_000) #=> 4000
p Integer(9.88) #=> 9
p Integer(nil) # can't convert nil into Integer (TypeError)
p Integer(Object.new) # cannot convert Object into Integer (TypeError)
p Integer("10") #=> 10
p Integer("10", 2) #=> 2
p Integer("0d10")......teger("1\n0") # `Integer': invalid value for Integer: "1\n0" (ArgumentError)
p Integer("hoge") # `Integer': invalid value for Integer: "hoge" (ArgumentError)
p Integer("") # `Integer': invalid value for Integer: "" (ArgumentError)
//}
@see String#hex,String#oct,String#to_i,Integer... -
Kernel
. # Float(arg) -> Float (25.0) -
引数を浮動小数点数(Float)に変換した結果を返します。
...換し、文字列の場合
は整数や浮動小数点数と見なせるもののみ変換します。
メソッド Float は文字列に対し String#to_f よりも厳密な変換を行います。
@param arg 変換対象のオブジェクトです。
@raise ArgumentError 整数や浮動小数......#=> 4000.0
p Float(9.88) #=> 9.88
p Float(Time.gm(1986)) #=> 504921600.0
p Float(Object.new) # can't convert Object into Float (TypeError)
p Float(nil) # can't convert nil into Float (TypeError)
p Float("10") #=> 10.0
p Float("10e2") #=> 1000.0
p Float("1e-2")......alid value for Float(): "0xa.a" (ArgumentError)
p Float(" \n10\s \t") #=> 10.0 # 先頭と末尾の空白類は無視される
p Float("1\n0") # invalid value for Float(): "1\n0" (ArgumentError)
p Float("") # invalid value for Float(): "" (ArgumentError)
//}
@see String#to_f,Float... -
Kernel
. # Float(arg , exception: true) -> Float | nil (25.0) -
引数を浮動小数点数(Float)に変換した結果を返します。
...換し、文字列の場合
は整数や浮動小数点数と見なせるもののみ変換します。
メソッド Float は文字列に対し String#to_f よりも厳密な変換を行います。
@param arg 変換対象のオブジェクトです。
@param exception false を指定すると、......#=> 4000.0
p Float(9.88) #=> 9.88
p Float(Time.gm(1986)) #=> 504921600.0
p Float(Object.new) # can't convert Object into Float (TypeError)
p Float(nil) # can't convert nil into Float (TypeError)
p Float("10") #=> 10.0
p Float("10e2") #=> 1000.0
p Float("1e-2")......alid value for Float(): "0xa.a" (ArgumentError)
p Float(" \n10\s \t") #=> 10.0 # 先頭と末尾の空白類は無視される
p Float("1\n0") # invalid value for Float(): "1\n0" (ArgumentError)
p Float("") # invalid value for Float(): "" (ArgumentError)
//}
@see String#to_f,Float...