【发布时间】:2016-09-28 17:16:44
【问题描述】:
textField.text.isEmpty
textField.text != ""
这两个函数将空格视为字符。但是,我希望我能够识别文本字段何时没有空格或不为空。
【问题讨论】:
-
你可能想要“修剪”空格,就像在:stackoverflow.com/questions/26797739/…
-
Trim 删除字符串开头和结尾的空格和换行符。这就是你要找的东西?看看:Does swift has trim method on String?.
-
@Pieter21 很好用,谢谢!