Double
struct Double
-
Creates a double from
PerlScalar
. Throws ifsv
contains something that not looks like a number.let i = try Double(PerlScalar(42.3)) // i == 42.3 let i = try Double(PerlScalar("42.3")) // i == 42.3 let i = try Double(PerlScalar()) // throws let i = try Double(PerlScalar("")) // throws let i = try Double(PerlScalar("any")) // throws let i = try Double(PerlScalar("50sec")) // throws
Declaration
Swift
public init(_ scalar: PerlScalar) throws
-
Creates a double from
PerlScalar
using Perl macrosSvNV
. Performs no additional checks.let i = Double(unchecked: PerlScalar(42.3)) // i == 42.3 let i = Double(unchecked: PerlScalar("42.3")) // i == 42.3 let i = Double(unchecked: PerlScalar()) // i == 0 let i = Double(unchecked: PerlScalar("")) // i == 0 let i = Double(unchecked: PerlScalar("any")) // i == 0 let i = Double(unchecked: PerlScalar("50sec")) // i == 50 let i = Double(unchecked: PerlScalar("50.3sec")) // i == 50.3
Declaration
Swift
public init(unchecked scalar: PerlScalar)