Your feedback is appreciated..Send Feedback Thank You.

How to check length of string greater than some number in Objective C?

Answer

  1. +(BOOL) isLengthGreaterThan:(NSString*) text chars:(int) len
  2. {
  3.     int length = 0;
  4.     if  (text == nil)
  5.     {
  6.         length= 0;
  7.     }
  8.     else
  9.     {
  10.         length = [text length];
  11.     }
  12.    
  13.     if (length > len)
  14.     {
  15.         return TRUE;
  16.        
  17.     }
  18.     else
  19.     {
  20.         return  FALSE;
  21.     }
  22.    
  23. }
Subscribe to DeveloperFeedDid you like this article? Did it Help you Solve your Problem? You can get the all the latest articles published at DeveloperFeed in your email inbox by entering your email address below. Your address will only be used for mailing you the articles, and each one will include a link so you can unsubscribe at any time.