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

August 13, 2011

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. }
Leave a reply
How do you create UIActionSheet elements dynamically in iOS?How do display a UIAlertView with Ok button only in iOS?
Sponsors
Like us on Facebook