SignedInteger
protocol SignedInteger : _SignedInteger, Integer
-
Mechanica
Creates a string representing the given value in the binary base.
Example:
255.binaryString //"11111111" Int16(-1).binaryString //"1111111111111111" 1.binaryString //"0000000000000000000000000000000000000000000000000000000000000001" (Int 64 bit) 1.binaryString //"00000000000000000000000000000001" (Int 32 bit)
Note
Negative integers are converted with the two’s complement operation. For signed binary useString(:,radix:)
Example:
String(Int8(-127), radix: 2) // -1111111 Int8(-127).binaryString // 10000001
Declaration
Swift
public var binaryString: String