Swift - Strings als Double validieren
Aus Wikizone
Version vom 7. Januar 2023, 20:52 Uhr von 134.3.86.14 (Diskussion) (Die Seite wurde neu angelegt: „== Texteingaben auf Double validieren und casten == <syntaxhighlight lang="swift"> let input = textView.text // get the input from the text view if let doubleV…“)
Texteingaben auf Double validieren und casten[Bearbeiten]
let input = textView.text // get the input from the text view
if let doubleValue = Double(input) {
// input is a valid double
// you can use doubleValue here
} else {
// input is not a valid double
}