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];
componentsseparatedbystring return nsarray. grab object @ index, , type cast nsstring when storing variable.
Comments
Post a Comment