I'm fetching value from RealmDB which is in string format. However this string contains values in arithmetic format like below
let values = ["1/2","1/3","2/3","3/5","1/7"]
Now my problem is that I've to return the addition value of whole array. I'm unable to convert it to Double value because the string itself contain arithmetic operator. How to perform addition on above array of string?
I've tried to use NSExpreesion to do the mathematical operation but it's giving nil value.
let expn = NSExpression(format:"1/3")
print(expn.expressionValue(with: nil, context: nil))