I hereby claim:
- I am albtsantos on github.
- I am albt (https://keybase.io/albt) on keybase.
- I have a public key ASC9hw9Lb7_Ve64vfXwteBY_aWmAr2Oyv6fBZhp2m0tz-Qo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
@infix func - (left: String, right: String) -> String { | |
var finalString = left | |
if left.hasSuffix(right) { | |
// the workaround to the compiler error is to cast the String to NSString before the substringToIndex method | |
var index = countElements(left) - countElements(right) | |
finalString = (left as NSString).substringToIndex(index) | |
} | |
return finalString |
@assignment @prefix func -- <T> (inout a: [T]) -> [T] { | |
if a.count > 0 { | |
a.removeLast() | |
} | |
return a | |
} | |
var names: [String] = ["iPhone", "iPad", "iPod", "Nexus"] | |
--names |
@infix func * (string: String, multiplicator: Int) -> String { | |
if multiplicator < 0 { | |
return "" | |
} | |
var finalString: String = "" | |
for i in 0..<multiplicator { | |
finalString += string | |
} |