Int Extension - Kelmatou/iOSTools GitHub Wiki

Methods

  • func isBetween(min: Int?, max: Int?) -> Bool
  • func toHexadecimal() -> String
  • func toBinary() -> String
  • func toBase(_ base: Int) -> String

Statics

  • func toHexadecimal(_ value: Int) -> String
  • func toBinary(_ value: Int) -> String
  • func toBase(_ value: Int, base: Int) -> String
  • func fromHexadecimal(_ value: String) -> Int?
  • func fromBinary(_ value: String) -> Int?
  • func fromBase(_ value: String, base: Int) -> Int?
  • func random(min: Int?, max: Int?) -> Int

Definitions

  • func isBetween(min: Int?, max: Int?) -> Bool: Indicates if an Int is in range [min, max]. If min is nil, then it is considered to be -infinite. If max is nil, then it is considered to be +infinite.

  • func toHexadecimal() -> String: Convert an Int value into hexadecimal format.

  • func toBinary() -> String: Convert an Int value into binary format.

  • func toBase(_ base: Int) -> String: Convert an Int value into base format.

  • static func toHexadecimal(_ value: Int) -> String: Convert value into hexadecimal format.

  • static func toBinary(_ value: Int) -> String: Convert value into binary format.

  • static func toBase(_ value: Int, base: Int) -> String: Convert value into base format.

  • static func fromHexadecimal(_ value: String) -> Int?: Convert a String representing the hexadecimal value into Int.

  • static func fromBinary(_ value: String) -> Int?: Convert a String representing the binary value into Int.

  • static func fromBase(_ value: String, base: Int) -> Int?: Convert a String representing the value encoded in base into Int.

  • static func random(min: Int?, max: Int?) -> Int: Generates a random number in range [min, max]. If min is nil, then it is considered to be Int32.min. If max is nil, then it is considered to be Int32.max.