Extending Int and String Utils

pull/6/head
Oguzhan Gungor 7 years ago
parent 39a1e6649d
commit a388c0546f
  1. 9
      Trust/Extensions/Int.swift
  2. 9
      Trust/Extensions/String.swift

@ -0,0 +1,9 @@
// Copyright SIX DAY LLC. All rights reserved.
import Foundation
extension Int {
func toBool() -> Bool {
return (self as NSNumber).boolValue
}
}

@ -54,6 +54,15 @@ extension String {
var add0x: String {
return "0x" + self
}
func toInt() -> Int? {
return Int(self) ?? nil
}
func toBool() -> Bool {
return (self.toInt()?.toBool())!
}
}
extension String {

Loading…
Cancel
Save