uzair dhada uzair dhada - 2 years ago 113
Objective-C Question

Get Particular string from NSString

I get

session["token2"] = "Token 90dcee1adc82c25f51fc9542e4f9efd338caa0b5"
and i just want
so what is the best way to get that token?

Answer Source

there are two methods of string, you can use that and get your final token.

NSString *strToken = @"Token 90dcee1adc82c25f51fc9542e4f9efd338caa0b5";

1st method :

NSString *strToken1 = [[strToken componentsSeparatedByString:@" "] lastObject];

2nd method :

NSString *strToken2 = [strToken substringFromIndex:6];

By both method you can get your token.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download