String String Mantenga solo números

let result = string.trimmingCharacters(in: CharacterSet(charactersIn: "0123456789.").inverted)
Troubled Termite