Created
March 25, 2018 19:17
-
-
Save nazrdogan/1423aa02b6971d5b4839b462c6ef7701 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func convertToTL(price:String) -> String { | |
let count = price.count; | |
if (count <= 2){ | |
return "0.\(price) TL" | |
} | |
else { | |
let suffix = price.suffix(2) | |
let prefix = price.prefix(count - 2) | |
return "\(prefix).\(suffix) TL" | |
} | |
} | |
convertToTL(price: "6") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment