NSString+Addition.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. //
  2. // NSString+Addition.h
  3. // PinChaoPhone
  4. //
  5. // Created by 克奎 岳 on 15/9/1.
  6. // Copyright (c) 2015年 LSY. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. @interface NSString (Addition)
  10. /**
  11. 计算单行行宽
  12. */
  13. - (CGFloat)commonStringWidthForFont:(CGFloat)fontSize;
  14. /**
  15. 计算行高
  16. */
  17. - (CGFloat)commonStringHeighforLabelWidth:(CGFloat)width withFontSize:(CGFloat)fontSize;
  18. /**
  19. 计算文本最后一个字坐标点,需输入Label的frame值
  20. */
  21. - (CGPoint)commonStringLastPointWithLabelFrame:(CGRect)frame withFontSize:(CGFloat)fontSize;
  22. /**
  23. 正则表达式判断
  24. */
  25. - (BOOL)isUserName;
  26. - (BOOL)isPassword;
  27. - (BOOL)isEmail;
  28. - (BOOL)isUrl;
  29. - (BOOL)isTelephone;
  30. - (BOOL) isEmpty;
  31. - (BOOL) isidentityCard;
  32. /**
  33. 在文本中间添加横划线
  34. @return NSMutableAttributedString
  35. */
  36. - (NSMutableAttributedString *)addTextCenterLine;
  37. // c纯数字
  38. - (BOOL)isNumber;
  39. +(NSString *)showTimeStrFormDate:(NSDate*)compareDate;
  40. // 判断是不是小数2位
  41. +(BOOL)isDecimalNum:(NSString *)numStr;
  42. @end