Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我搜索如何用 Swift 5 在 UITextField 中的 numberPad 中用点替换逗号分隔符。
我试过这个,但没有用。
let commaValue = textField.text! let decimalValue = Double(commaValue.replacingOccurrences(of: ",", with: "."))
你可以使用这个:
let commaValue = "2,3" let replaced = String(commaValue.map { $0 == "," ? "." : $0 })