String parsing in Objective-C -


when have pf:/abc/def/, how can /abc/def/?

with python, can use

string = 'pf:/abc/def/' string.split(':')[1] 

or even

string[3:] 

what's equivalent function in objective-c?

nsstring *string = [nsstring stringwithformat:@"pf:/abc/def/"]; nsarray *components = [string componentsseparatedbystring: @":"]; nsstring *string2 = (nsstring*) [components objectatindex:1]; 

reference: http://developer.apple.com/library/mac/documentation/cocoa/reference/foundation/classes/nsstring_class/reference/nsstring.html#//apple_ref/occ/instm/nsstring/componentsseparatedbystring:

componentsseparatedbystring return nsarray. grab object @ index, , type cast nsstring when storing variable.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -