Hey everbody, i'm trying to convert one string to an array. My php is setting this:
echo "Logged/".$name;
So, how can i take 'Logged' and the 'Name' as two differents strings? And how can i call it?
Thanks!
If you read your string like: "logged/name" into an NSString
, you can use
- (NSArray *)componentsSeparatedByString:(NSString *)separator
to split it, like:
NSString *list = @"logged/name";
NSArray *listItems = [list componentsSeparatedByString:@"/"];
Would produce an NSArray
of two NSStrings
:
[ @"logged", @"name" ]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With