I've tried implementing the dot or "point" in calculator I'm programming the windows 7 calculator as a reference to my calcu.
I've tried this in my code:
@IBAction func btnDot(sender: AnyObject) {
if(lblResult.text!.characters.count == 0) {
lblResult.text = "0."
}
else {
if(Float(lblResult.text!.lowercaseString.characters.contains(".")) == -1) {
lblResult.text = lblResult.text! + "."
}
}
lblResult.text = lblResult.text
}
but the function btnDot doesn't seem to work. What seems to be the problem here?
Note: The lblResult.text is the Id of my UILabel for the display of results