UInt
struct UInt : UnsignedInteger, Comparable, Equatable
-
Creates an unsigned integer from
PerlScalar
. Throws ifsv
does not contain an unsigned integer.let u = try UInt(PerlScalar(100)) // u == 100 let u = try UInt(PerlScalar("100")) // u == 100 let u = try UInt(PerlScalar(42.5)) // u == 42 let u = try UInt(PerlScalar()) // throws let u = try UInt(PerlScalar("")) // throws let u = try UInt(PerlScalar("any")) // throws let u = try UInt(PerlScalar("50sec")) // throws let u = try UInt(PerlScalar("10000000000000000000")) // u == 10000000000000000000 let u = try UInt(PerlScalar("20000000000000000000")) // throws let u = try UInt(PerlScalar("-10")) // throws let u = try UInt(PerlScalar("-20000000000000000000")) // throws
Declaration
Swift
public init(_ scalar: PerlScalar) throws
-
Creates an unsigned integer from
PerlScalar
using Perl macrosSvUV
. Performs no additional checks.let u = UInt(unchecked: PerlScalar(100)) // u == 100 let u = UInt(unchecked: PerlScalar("100")) // u == 100 let u = UInt(unchecked: PerlScalar(42.5)) // u == 42 let u = UInt(unchecked: PerlScalar()) // u == 0 let u = UInt(unchecked: PerlScalar("")) // u == 0 let u = UInt(unchecked: PerlScalar("any")) // u == 0 let u = UInt(unchecked: PerlScalar("50sec")) // u == 50 let u = UInt(unchecked: PerlScalar("10000000000000000000")) // u == 10000000000000000000 let u = UInt(unchecked: PerlScalar("20000000000000000000")) // u == UInt.max let u = UInt(unchecked: PerlScalar("-10")) // u == UInt(bitPattern: -10) let u = UInt(unchecked: PerlScalar("-20000000000000000000")) // u == UInt(bitPattern: Int.min)
Declaration
Swift
public init(unchecked scalar: PerlScalar)