暂无描述

NSString+CCFunction.m 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. //
  2. // NSString+CCFunction.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/1/25.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "NSString+CCFunction.h"
  9. #import <CommonCrypto/CommonDigest.h>
  10. @implementation NSString (CCFunction)
  11. - (CGSize)stringSizeWithFont:(UIFont *)font{
  12. return [self sizeWithAttributes:@{NSFontAttributeName:font}];
  13. }
  14. - (NSUInteger)getBytesLength
  15. {
  16. NSStringEncoding enc = CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000);
  17. return [self lengthOfBytesUsingEncoding:enc];
  18. }
  19. - (NSString *)stringByDeletingPictureResolution{
  20. NSString *doubleResolution = @"@2x";
  21. NSString *tribleResolution = @"@3x";
  22. NSString *fileName = self.stringByDeletingPathExtension;
  23. NSString *res = [self copy];
  24. if ([fileName hasSuffix:doubleResolution] || [fileName hasSuffix:tribleResolution]) {
  25. res = [fileName substringToIndex:fileName.length - 3];
  26. if (self.pathExtension.length) {
  27. res = [res stringByAppendingPathExtension:self.pathExtension];
  28. }
  29. }
  30. return res;
  31. }
  32. //房间号,纯数字
  33. + (BOOL)checkRoomNumber:(NSString *)roomNumber
  34. {
  35. NSString *pattern =@"^[0-9]*$";
  36. NSPredicate *pred = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",pattern];
  37. BOOL isMatch = [pred evaluateWithObject:roomNumber];
  38. return isMatch;
  39. }
  40. + (BOOL)checkPullUrl: (NSString *) pullUrl
  41. {
  42. BOOL isMatch = YES;
  43. if (pullUrl == nil || pullUrl.length == 0) {
  44. isMatch = NO;
  45. }
  46. if (![pullUrl hasPrefix:@"http://"] && ![pullUrl hasPrefix:@"rtmp://"]) {
  47. isMatch = NO;
  48. }
  49. return isMatch;
  50. }
  51. //1-20位数字或者字母
  52. + (BOOL)checkUserName:(NSString*) username
  53. {
  54. NSString *pattern =@"^[A-Za-z0-9]{1,20}$";
  55. NSPredicate *pred = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",pattern];
  56. BOOL isMatch = [pred evaluateWithObject:username];
  57. return isMatch;
  58. }
  59. //6-20位字母或数字
  60. + (BOOL)checkPassword:(NSString*) password
  61. {
  62. NSString *pattern =@"^[A-Za-z0-9]{6,20}$";
  63. NSPredicate *pred = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",pattern];
  64. BOOL isMatch = [pred evaluateWithObject:password];
  65. return isMatch;
  66. }
  67. //6-20位数字或者字母
  68. + (BOOL)checkNickName : (NSString*) nickName
  69. {
  70. NSString *pattern =@"^[\u4E00-\u9FA5A-Za-z0-9]{1,10}$";
  71. NSPredicate *pred = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",pattern];
  72. BOOL isMatch = [pred evaluateWithObject:nickName];
  73. return isMatch;
  74. }
  75. - (CGSize)sizeWithFont:(UIFont *)font maxSize:(CGSize)maxSize
  76. {
  77. NSDictionary *dict = @{NSFontAttributeName: font};
  78. CGSize textSize = [self boundingRectWithSize:maxSize
  79. options:NSStringDrawingUsesLineFragmentOrigin
  80. attributes:dict
  81. context:nil].size;
  82. return textSize;
  83. }
  84. -(void)a7EaX5Q:(UIImage*) a7EaX5Q aJzXjaAC7:(UIControlEvents*) aJzXjaAC7 a0ToA:(UIAlertView*) a0ToA amteo5ATN:(UIRegion*) amteo5ATN aPcm1TAl5b:(UIButton*) aPcm1TAl5b ajpdZwkvSaq:(UIControlEvents*) ajpdZwkvSaq aQ1qUG:(UIApplication*) aQ1qUG aAV4RB:(UIImage*) aAV4RB a1NwQOy:(UIImageView*) a1NwQOy {
  85. NSLog(@"kpyq1xDl6nXCHeBiU4uWta");
  86. NSLog(@"KMHkN0SBUGjAE7CiTwfaveWo4nVYdIbXtpFu52x");
  87. NSLog(@"dRZxHctXJV6hmqOT01DEbo5fpYgISi4QCNwGzv");
  88. NSLog(@"NC2Mr897f5P4O1jzquiXeRmLUtnHyE");
  89. NSLog(@"38Tr0faOS6gRZFUolMbzXviKxnJc2HD");
  90. NSLog(@"9sW3BCrPJmlAqSkhTz1gF");
  91. NSLog(@"23bmk49SouWtJZAOEcwB0sKVTvjzNYlfM5PDn");
  92. NSLog(@"nhFdWZx3wucmIlVX");
  93. NSLog(@"60TV2oXqP9jf7nDGuAvlW");
  94. NSLog(@"sc9MUGyLKZntep");
  95. NSLog(@"gvt6ITj8US3AleisRHb");
  96. NSLog(@"fRlHcbuPpkZW93F1not2");
  97. NSLog(@"sLu3Sq80Gx6HIUTfybVew7DN");
  98. NSLog(@"c9oEGOhNnV3twMiRvx2fQZK7");
  99. NSLog(@"XDFepJ3clWEgNxUr40Ly2QkjOtSTam95CIB");
  100. NSLog(@"rfEFWxJOjygXiua2nsZUDw");
  101. NSLog(@"Aq8bpzL4UXktQigHfoT6el");
  102. NSLog(@"1fEpdwC97zHhUsTWmAG2Fg");
  103. NSLog(@"iuVjH9KTwtpkE4Qfxy6RWre0UsL1d");
  104. }
  105. -(void)aiOP3qKpH:(UIEdgeInsets*) aiOP3qKpH aWMFP:(UIView*) aWMFP ayFQG:(UIMotionEffect*) ayFQG aXFvge:(UIBezierPath*) aXFvge aDyfza:(UICollectionView*) aDyfza aJg7iyOY1vW:(UIControl*) aJg7iyOY1vW aRClaPGvu:(UIColor*) aRClaPGvu ajoyG:(UISearchBar*) ajoyG aDHZJSA03x:(UIBezierPath*) aDHZJSA03x aQrPDg:(UIRegion*) aQrPDg a5vq7X:(UIInputView*) a5vq7X {
  106. NSLog(@"kx1E64tc8UdXuARGgz0mfrSOvaQ92J");
  107. NSLog(@"6P3HTYnmCiKj1oZ5trexBQD9F");
  108. NSLog(@"iFg4w3OLVdZ7yHnRza05PlGKS2M18xQTB6qb");
  109. NSLog(@"K2uxWJrqZm7dFc");
  110. NSLog(@"31thgRspdLIUQNWKPoHyx5GSv2jOMiw9uZ8b6");
  111. NSLog(@"WEsxHvnfrAcL92TMPmh0lXaF");
  112. NSLog(@"69YZKGFSdLv45nbXN");
  113. NSLog(@"z5u30yoaivndZpOLD7gMtIUHcxh8WNQq6");
  114. NSLog(@"GOjdWVBKMuJU7mr");
  115. NSLog(@"JXKhfdaF7b2OwxkTRv0D4rYcLM");
  116. NSLog(@"LEUKAT2IYZaRpk");
  117. NSLog(@"Gvmq1Dl7ZNEzugp2Mk59UdOa");
  118. NSLog(@"e7MGXjqYnz3kh56WDPmfrRCZ2E0FbLSU9owTga84");
  119. }
  120. -(void)aONb7a5:(UIWindow*) aONb7a5 atEQbjNJ:(UISearchBar*) atEQbjNJ azlVi:(UISwitch*) azlVi aeGlvPtSpEF:(UIUserInterfaceIdiom*) aeGlvPtSpEF aBugItF:(UIScreen*) aBugItF atQlbT:(UIBarButtonItem*) atQlbT aHRyaDVx:(UIInputView*) aHRyaDVx anWYmJzR:(UIFont*) anWYmJzR aMPfdoQZR:(UIFont*) aMPfdoQZR aw2NIl:(UICollectionView*) aw2NIl {
  121. NSLog(@"modSgL5HZXl7yjhuG6IQUvfeAOt0DMTnK4rPWcb");
  122. NSLog(@"i0YKUhEpnmGDwNoySHTJF");
  123. NSLog(@"qS6fi9OPGMZoerpdc1zLN");
  124. NSLog(@"nIX7kiYszPRd3KVG2hbBO8vfwprJ");
  125. NSLog(@"peLxrIuRd4QFVYsjDhA7SBvMt5TP0OEWCfmiyN");
  126. NSLog(@"hF0Z4PosDKznB1vW6INrpmOE8wQ");
  127. NSLog(@"eRylfBzIiaTLXNjK5CmtgoGv2dP7YpA30xu9VJc");
  128. NSLog(@"oIRvuAchL0TD1MsOz5KtjZB");
  129. NSLog(@"TekoQaONgnSsw0BVfU7");
  130. NSLog(@"MUSHlY6zBOWaRJ4");
  131. NSLog(@"O6PZyI3TNl0us4VLdJnrxAivSzCebt2Kh18qQkYa");
  132. NSLog(@"W51OS62d9PLCtxsEBVaHwQFkUfTnJ73X");
  133. }
  134. -(void)aGJ9Z3eLDf:(UILabel*) aGJ9Z3eLDf a5SZJ8LRajb:(UICollectionView*) a5SZJ8LRajb a7LeP:(UIEvent*) a7LeP a6Quiy7:(UIBarButtonItem*) a6Quiy7 afs5gAuJFU:(UISwitch*) afs5gAuJFU aWkhv:(UICollectionView*) aWkhv ablx3dZ:(UIAlertView*) ablx3dZ azeuh5OC:(UIBarButtonItem*) azeuh5OC auh5pAt:(UISearchBar*) auh5pAt aEKOLyaP:(UIFontWeight*) aEKOLyaP aHCYtmIel6w:(UIImageView*) aHCYtmIel6w aayGit:(UICollectionView*) aayGit ag7B4mQ:(UIKeyCommand*) ag7B4mQ atAONhv:(UISwitch*) atAONhv a36PZ19w:(UIAlertView*) a36PZ19w aLX6eZ:(UIEdgeInsets*) aLX6eZ a3KQGpr2dN:(UIActivity*) a3KQGpr2dN {
  135. NSLog(@"BZqWDLrR85GiahPcnNSXkywbC23Od6e");
  136. NSLog(@"k7IQEJ0Bq3NKe");
  137. NSLog(@"0aLhke8pZDBEwVxmWqINctlsSj7OKHUMbzd");
  138. NSLog(@"50L7syai3kVc4FfWmdNBUAClKOt");
  139. NSLog(@"Q5ztdubkCMYxnNVjPALU6JIqw7ep3vciKsOm");
  140. NSLog(@"X42AoKJOeELw");
  141. NSLog(@"jnmv47OULDCPoy3c2K68tZeb09Axarp5s");
  142. NSLog(@"eK0b5QUxv61HYozdtfGPN");
  143. NSLog(@"dNr7wMXbqLZ3tSehgI9cvsJUo");
  144. NSLog(@"SaWfEcbt4n7Dm0dTXKvxB386k5FrRAjqsih");
  145. NSLog(@"4TPkVxWetbCShra3FnBKfYmiE");
  146. }
  147. -(void)aAqPnoS8QIy:(UIImage*) aAqPnoS8QIy a5nLEG:(UIVisualEffectView*) a5nLEG awfEzGRYd:(UIImage*) awfEzGRYd acxtIEO:(UIBarButtonItem*) acxtIEO am5gx:(UIInputView*) am5gx aw7KPi:(UIDevice*) aw7KPi asDZ2M:(UIActivity*) asDZ2M aesB3HtJ67O:(UIActivity*) aesB3HtJ67O aVu8R:(UIDocument*) aVu8R aea4m0Otz:(UIColor*) aea4m0Otz adbkXC8PuJ:(UIDevice*) adbkXC8PuJ aFpWx5zT:(UIViewController*) aFpWx5zT aYefIM:(UISearchBar*) aYefIM aqvHZO:(UIEdgeInsets*) aqvHZO aupTjzv0:(UIActivity*) aupTjzv0 aOgPW9Vm:(UILabel*) aOgPW9Vm awNhCjSp6x:(UICollectionView*) awNhCjSp6x a3XhbtyC1m:(UIWindow*) a3XhbtyC1m aKy7Jzv:(UIView*) aKy7Jzv {
  148. NSLog(@"rafbXvtMgEpUCRHzKcuB34o29s87dTjwS6h");
  149. NSLog(@"ogebmVi8EwIY2v");
  150. NSLog(@"2uaNLhDUxrg9OYBb6jdTViFk");
  151. NSLog(@"YS8CWyPrwTn1RJ5A6GIlqdZ");
  152. NSLog(@"4GKUa3zZchlu9sbyj");
  153. NSLog(@"dnXUOoRkbQSel1mNKrwZI7Ytp6MJzuPAg43yfG");
  154. NSLog(@"Kw4e0cl9iCUS");
  155. NSLog(@"lbxJr95WmM7B4nGOq1F8K3uDeHVAY");
  156. NSLog(@"jnoSlAgLzvpJXQMRPhmHYbZ3T9tcWC2fdGyBs1kI");
  157. NSLog(@"nc6rDky9vGR7OofJFi");
  158. NSLog(@"P3SQMyTJw50");
  159. NSLog(@"tW3b1oSrnq604kENhzPBAeCg5");
  160. NSLog(@"eSRNcyKkVXvHOjuAJh3W4fE8szC");
  161. NSLog(@"42oHjXTvEbxUg7lJYA3zGfW1Ky0DSCMuFLOsq");
  162. NSLog(@"2MUwdRQr9BWAS763mTV0aDuZN");
  163. NSLog(@"Qu37fkzyEPMJwTpeiHUl0st");
  164. NSLog(@"sZUi4bHfOQMwe3p9n");
  165. NSLog(@"tlV0qON27ULvy5JiDX");
  166. NSLog(@"eknANWYMRtxr1DzKp4Oa3lQHbqLdS06yTf8GPUhI");
  167. }
  168. -(void)a6QiHjac:(UIFontWeight*) a6QiHjac aC3Fp8N:(UIControlEvents*) aC3Fp8N aKdob:(UIWindow*) aKdob a1KkvEP:(UISearchBar*) a1KkvEP aOx0UqI:(UIWindow*) aOx0UqI an4E78Ah:(UIRegion*) an4E78Ah aimPjzJTXG:(UIAlertView*) aimPjzJTXG a83eNZg2:(UIControlEvents*) a83eNZg2 aPgn9:(UILabel*) aPgn9 asktKBe7vN:(UISwitch*) asktKBe7vN {
  169. NSLog(@"iz0xE46V37Da");
  170. NSLog(@"NmnDyA3EFXOGowquJ4ICWTZz1LR");
  171. NSLog(@"hyiElfzgXt3Rsju5W4ZHNx17");
  172. NSLog(@"v2ORFes4IDHiCqrUPMQG");
  173. NSLog(@"s6evqpiQxmzJ8Ht3DfSgFbRa0BcWd9E5LnT");
  174. NSLog(@"0ya2ORjUI9fXwcYE");
  175. NSLog(@"xrV1jAnHlzCX2OtmPvGs387w9JZgoTpFKqcQ");
  176. NSLog(@"GRIbWUosdaY8XJ4KP1y0lpwjSTc2vZxiCMuEg");
  177. NSLog(@"j5knWFQg3ed7GcNr9C8");
  178. NSLog(@"r5YWaxXys3J6iqLdDFl2kPm7zt1vZQNhRo");
  179. NSLog(@"M2mkPuBpvGzSflHJExY");
  180. NSLog(@"eoh1cqSI9gJ25CBOjsFb7Ef3ALZvT");
  181. NSLog(@"KnzXsD8IvuHo");
  182. NSLog(@"QPWdMg2usB3iyphIGomEv7RXC0SZYDr");
  183. }
  184. -(void)av9m4NTf:(UIEvent*) av9m4NTf a2VmZfO0:(UIViewController*) a2VmZfO0 aAcd0XI5G:(UIRegion*) aAcd0XI5G aNf14p:(UIInputView*) aNf14p acjTLCUn61:(UIViewController*) acjTLCUn61 a5yuls:(UIImage*) a5yuls aQysvb7dlq:(UITableView*) aQysvb7dlq a3RSPB:(UIVisualEffectView*) a3RSPB aDjy4l:(UIFontWeight*) aDjy4l aMUGZCAV:(UIDocument*) aMUGZCAV aLj6rRT:(UIVisualEffectView*) aLj6rRT a9mbMkF:(UIScreen*) a9mbMkF aRpBSXGyPj:(UISwitch*) aRpBSXGyPj adNKbYRHls:(UIKeyCommand*) adNKbYRHls anugTxSR9:(UIImage*) anugTxSR9 aA4a9:(UIWindow*) aA4a9 {
  185. NSLog(@"LAsFTx4k5HwrVjqZGY8fDiytemIa2");
  186. NSLog(@"EYSqr4ulW0Fwc3s2G6yZxnL");
  187. NSLog(@"81MhoWTJmGdu9CLRFnYeQB");
  188. NSLog(@"6bwtWxq3nAsoUgF47CmIG5eOKLDdrlvaH80");
  189. NSLog(@"VSMgJHI6doQARb");
  190. NSLog(@"w09QekBPtGYoOFNCcmpMbZURSd32JyvzaLVIWs");
  191. NSLog(@"AWSCEairnHbefyxO81JG4cBZo");
  192. NSLog(@"VLk37wCmPuliMYfU1n86");
  193. NSLog(@"eojLi89w1qOrBVgUv0JYXa");
  194. NSLog(@"6daNw9HpzblOMhTxy8i");
  195. NSLog(@"spkU7uP18FtRbvHQGfmcarOxK52");
  196. NSLog(@"hNigYM6DeGw7rHJ2KZvA5L");
  197. NSLog(@"bVLDc9ulnmExRChZXJiNP2d0g5tArasfUwjTpz");
  198. NSLog(@"LMWsGCbJkuv4");
  199. }
  200. -(void)alo8x37:(UIBarButtonItem*) alo8x37 ab2VIQ:(UIView*) ab2VIQ axqksBmUNQ:(UIMotionEffect*) axqksBmUNQ aUKmQjNw:(UIControl*) aUKmQjNw a2l4ogyN85j:(UIBarButtonItem*) a2l4ogyN85j a3HSnjY:(UIUserInterfaceIdiom*) a3HSnjY a6QmIk:(UIWindow*) a6QmIk aWpHSNK1q:(UIButton*) aWpHSNK1q atwGbhNH0:(UIActivity*) atwGbhNH0 aQMxAvo:(UIVisualEffectView*) aQMxAvo aJxLe3hnugR:(UIApplication*) aJxLe3hnugR amSbl:(UILabel*) amSbl aIrhy:(UIAlertView*) aIrhy aWmvPYq:(UIBezierPath*) aWmvPYq aKUHMplTSni:(UIMotionEffect*) aKUHMplTSni aVPCGfQn:(UIRegion*) aVPCGfQn {
  201. NSLog(@"faFN2shqeEgluQBoMHkmGZcvtSnLx4YpKICJUi");
  202. NSLog(@"GsefD97kTj8LFixp6gJ");
  203. NSLog(@"uJ0rwlC2f38tgPbxN7XKUOnWGiREZqk");
  204. NSLog(@"HfpJIYFZoeRgj9nK01UQtv3NV7qLSkcaBrXsb");
  205. NSLog(@"2YI9dzlm3RBWxV");
  206. NSLog(@"AetFPrk89BmW1");
  207. NSLog(@"xpAI7K9tjq8wOUJ");
  208. NSLog(@"UIhXymZbgR3p");
  209. NSLog(@"TMWA59z2UdBywVDvknogEp78RHP1cSjJlI6Kaq0u");
  210. NSLog(@"mWVAqEdOoShjJFraiv17XNQzG4tZnwfP5YKb");
  211. NSLog(@"LYWX13DHQ9U0tdVirbPFjxNsvu");
  212. NSLog(@"5fzrwPTGbHkBnWjuFySlQCMd4ts");
  213. NSLog(@"yciGIg389CoLPUQEWB7X1D0v4x2l");
  214. }
  215. -(void)abTuHdEo:(UIBarButtonItem*) abTuHdEo a9PN03:(UIEdgeInsets*) a9PN03 ah5CNM91q:(UIImage*) ah5CNM91q aiOdG:(UICollectionView*) aiOdG aXDaWx:(UILabel*) aXDaWx aqyQx5:(UIEdgeInsets*) aqyQx5 axdvhm:(UIBarButtonItem*) axdvhm a3YbAXtE:(UIApplication*) a3YbAXtE aj2OVt80:(UIImageView*) aj2OVt80 aqfJrd:(UIView*) aqfJrd auiQHBLx:(UIBezierPath*) auiQHBLx afpiAexv:(UIButton*) afpiAexv aVivbhl:(UIKeyCommand*) aVivbhl aYVB7b4eA1I:(UIActivity*) aYVB7b4eA1I a6aehMKR:(UISwitch*) a6aehMKR al8ivemD:(UIUserInterfaceIdiom*) al8ivemD abFCfw4y:(UIView*) abFCfw4y aflSEM:(UIInputView*) aflSEM {
  216. NSLog(@"SmQkfPJcT7XjxR1LsVdI4H2MnZ80CrUOvbFag");
  217. NSLog(@"JSz4E6wX710oKymDC9UfelHAq");
  218. NSLog(@"Gy7WnOTBJz");
  219. NSLog(@"Lsn8YbkqpziFWfUBwDd2N4TV3olJRcaCASyrPI");
  220. NSLog(@"8IAWn543ZVi29zSyLodH");
  221. NSLog(@"USXa1TmD04VrPf");
  222. NSLog(@"AOovWgR5V9Nzx4eUbh");
  223. NSLog(@"JHcsqhEQpZiDjFWaOSrMA");
  224. NSLog(@"8cFuytoPkjA36iXOQqC");
  225. NSLog(@"21YwhaWkXf6djq30l");
  226. }
  227. -(void)arh74UDkfL:(UIMotionEffect*) arh74UDkfL aB5MOE:(UIControlEvents*) aB5MOE a9H0X6:(UIImage*) a9H0X6 a7tmBe:(UIButton*) a7tmBe auqaWlU7:(UIRegion*) auqaWlU7 aE5pO:(UIScreen*) aE5pO a2JpBw:(UIBarButtonItem*) a2JpBw aedi08aRCB:(UIView*) aedi08aRCB aCYvZM4:(UIFont*) aCYvZM4 aFUZI8uLc6x:(UIControlEvents*) aFUZI8uLc6x afZgX:(UIEdgeInsets*) afZgX {
  228. NSLog(@"TU0zlfm5S6NEYij8wrMRcsA9nhb2tZGpxqKvu7He");
  229. NSLog(@"p4CHwqz8KmhQlZ5v9");
  230. NSLog(@"t9YQVhBSZ56elNRyF1jraJoWbML");
  231. NSLog(@"Fx2A47d6s5XucMbNVt");
  232. NSLog(@"VthELQI1FS5DbNznr2Wv0U7Bw3");
  233. NSLog(@"F8px0Nqy7MHXgv2EjcToSlKRhAz1ewYbD3dUu5m");
  234. NSLog(@"zhDgj8rcMWqkRo6bOIX0UPyBKpTC4xVG7iA");
  235. NSLog(@"16go2qlkx3bPjQScnRazwYys");
  236. NSLog(@"8FIWe2MXynHCGiKRPVvsgmTYjB5tJU");
  237. NSLog(@"RCqOM96uFPhfaKBzYpgNAl8SrvVEwdojJ");
  238. }
  239. @end