I'm using this code to return the calculation of a string:
func calcString(txt: String) -> String {
let expn = NSExpression(format: txt)
var final: AnyObject = expn.expressionValueWithObject(nil, context: nil)
return "\(final)"
}
How can I test that the string contains a valid formula?