检验输入框为空以及输入参数只有空格的判断
2015-08-30 18:04
417 查看
#pragma mark 检验输入框为空以及输入参数只有空格的判断 Yes:是空白,或者为空 NO:不是空白 -(BOOL)isEmpty:(NSString *)str{ if (str) { //A character set containing only the whitespace characters space (U+0020) and tab (U+0009) and the newline and nextline characters (U+000A–U+000D, U+0085). NSCharacterSet *set = [NSCharacterSet whitespaceAndNewlineCharacterSet]; //Returns a new string made by removing from both ends of the receiver characters contained in a given character set. NSString *trimedString = [str stringByTrimmingCharactersInSet:set]; if ([trimedString length] == 0) { return YES; } else { return NO; } }else{ return YES; } }
相关文章推荐
- 模糊kmeans聚类
- CallBack 实例演练
- IOS 开发 点击屏幕非UITextField处 也收回键盘
- Java初学者都必须理解的六大问题
- 八月照相馆
- 堆排序
- LINUX安装源码软件经典三部曲
- 微软笔试题 HihoCoder#1137: Recruitment 题解
- 【HDU4081】【次最小生成树变形】【要保持一直的风格】【注意读入数据啊】
- +_+ +_+ +_+
- 算法的复杂度
- 树莓派 HC-SR04 模块使用
- python 抓取当当网的图书数据
- web.xml Servlet Configuration
- NOIP 统计单词个数
- HDU 5422-Rikka with Graph(规律题)
- css布局模型
- Android的drawText()参数详解
- Android 中 Context 的理解及使用
- Swift UIView 层次调整