I consume a service "x" which gives me the balance of the accounts
for example em will return 98675.38282761
What I need is to stay alone with 2 decimals, I currently get the balance and I show it in a label as follows:
let balanceNumber = (messageRS["balance"] as? NSNumber)!
var balance = balanceNumber.stringValue
if(balance.isEmpty){
balance = (messageRS["availableBalance"] as? String)!
}
if(!balance.isEmpty){
self.strLblAccountBalance.text = newBalanceMsg.replacingOccurrences(of: "/(balance)/", with: balance)
}else{
self.strLblAccountBalance.text = newBalanceMsg.replacingOccurrences(of: "/(balance)/", with: "---")
}
How could I just print the number with 2 decimals