init?(String)
Creates a new integer value from the given string.
与えられた文字列から新しい整数値を作成します。
source
is removed.
与えられた浮動小数点値から整数を作成します、ゼロへの丸めを行います。source
として渡される値の小数部分は何であれ取り除かれます。
Availability
Technology
init<T>(_ source: T) where T : BinaryFloatingPoint
source
A floating-point value to convert to an integer. source
must be representable in this type after rounding toward zero.
整数へと変換する浮動小数点値.source
は、ゼロへの丸め後にこの型において表現可能でなければなりません。
let x = Int(21.5)
// x == 21
let y = Int(-21.5)
// y == -21
If source
is outside the bounds of this type after rounding toward zero, a runtime error may occur.
source
がゼロへの丸め後にこの型の境界の外側ならば、実行時エラーが起こるかもしれません。
let z = UInt(-21.5)
// Error: ...outside the representable range
init?(String)