views:

54

answers:

4

Hi I am having a string as G531 Other Dough Products.

Here I want only Other Dough Products, reply me with code.

I tried with substring but that is not working.

Thanks in advance .

A: 
NSString* s = [@"G531 Other Dough Products" substringFromIndex:5];
skorulis
+1  A: 

You don't actually say what you tried but substringFromIndex:

NSString *str = @"G531 Other Dough Products";
str = [str substringFromIndex:5];

should do the trick.

You'll probably find that you want to use 5 unless you want the leading space in your new string.

paxdiablo
ya thanks it really worked
mrugen
A: 

Try using "substringFromIndex" (see documentation)

Kevin Sylvestre
A: 

He He, you can also do this as below,

NSString * newString = [NSString stringWithCString:(const char*)&"G531 Other Dough Products"[5] encoding:NSUTF8StringEncoding];
NSLog(@"%@", newString); 
alones