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 .
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 .
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.
He He, you can also do this as below,
NSString * newString = [NSString stringWithCString:(const char*)&"G531 Other Dough Products"[5] encoding:NSUTF8StringEncoding];
NSLog(@"%@", newString);