I have a string "25% off", i want to extract only value 25 from this, how can i extract it in swift, previously i had done with objective c but in swift hoe can we do that? I have tried this code but failed,
let discount = UserDefaults.standard.string(forKey: "discount")
print(discount)
let index = discount?.index((discount?.startIndex)!, offsetBy: 5)
discount?.substring(to: index!)
print(index)
How can i get 25 from it?