2016-08-14 22:46:03 +03:00
|
|
|
/**
|
|
|
|
* Tae Won Ha - http://taewon.de - @hataewon
|
|
|
|
* See LICENSE
|
|
|
|
*/
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
|
|
|
|
func call(@autoclosure closure: () -> Void, when condition: Bool) { if condition { closure() } }
|
2016-08-21 01:17:19 +03:00
|
|
|
func call(@autoclosure closure: () -> Void, whenNot condition: Bool) { if !condition { closure() } }
|
|
|
|
|
|
|
|
extension String {
|
|
|
|
|
|
|
|
func without(prefix prefix: String) -> String {
|
|
|
|
guard self.hasPrefix(prefix) else {
|
|
|
|
return self
|
|
|
|
}
|
|
|
|
|
|
|
|
let idx = self.startIndex.advancedBy(prefix.characters.count)
|
|
|
|
return self[idx..<self.endIndex]
|
|
|
|
}
|
|
|
|
}
|