Hi all i want extract the last part from string which is a four digit number \'03276\' i:e http://www.abc.com/news/read/welcome-new-gig/03276
how can i
If you know how many characters you need, you can do something like this:
NSString *string = @"http://www.abc.com/news/read/welcome-new-gig/03276";
NSString *subString = [string substringFromIndex:[string length] - 5];
If you just know that it's the part after the last slash, you can do this:
NSString *string = @"http://www.abc.com/news/read/welcome-new-gig/03276";
NSString *subString = [[string componentsSeparatedByString:@"/"] lastObject];