-4

Possible Duplicate:
how to get substring of nsstring?
how do I get a substring in iOS?

I am new to iphone.In my project i have a string such as chapter1 but actually i want the substring 1 only how it is possible.if any body know this please help me

Community
  • 1
  • 1
  • 2
    Uh, read the spec for NSString, perhaps? – Hot Licks May 29 '12 at 02:05
  • such a easy question to find on NSString reference https://www.google.com/search?sugexp=chrome,mod=14&sourceid=chrome&ie=UTF-8&q=nsstring+reference – RollRoll May 29 '12 at 02:06
  • Ctrl + F for "substring": https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html – eboix May 29 '12 at 02:06

1 Answers1

0

Check out the substringFromIndex: or substringToIndex: methods of NSString. You can find the documentation for NSString here.

Ex:

  NSString *string = @"Chapter1";  
  NSString *newString = [string subStringFromIndex: ([string length] - 1)]; // => "1"
ab217
  • 16,900
  • 25
  • 74
  • 92