6_Objective-C Strings

The string in Objective-C programming language is represented using NSString

What is the NSString

NSString its subclass of NSMutableString provides several ways for creating string objects.

The simplest way to create a string object is to use the Objective-C @”…” construct:

Simple Example of nsstring

List of important functions 

  • – (NSString *)capitalizedString;
  • – (unichar)characterAtIndex:(NSUInteger)index;
  • – (double)doubleValue;
  • – (float)floatValue;
  • – (BOOL)hasPrefix:(NSString *)aString;
  • – (BOOL)hasSuffix:(NSString *)aString;
  • – (id)initWithFormat:(NSString *)format …;
  • – (NSInteger)integerValue;
  • – (BOOL)isEqualToString:(NSString *)aString;
  • – (NSUInteger)length;
  • – (NSString *)lowercaseString;
  • – (NSRange)rangeOfString:(NSString *)aString;
  • – (NSString *)stringByAppendingFormat:(NSString *)format …;
  • – (NSString *)stringByTrimmingCharactersInSet:(NSCharacterSet *)set;
  • -(NSString *)substringFromIndex:(NSUInteger)anIndex;

Example makes use of few of the above-mentioned functions:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: