1. 程式人生 > >[iOS] objective c getting substring after and before dot

[iOS] objective c getting substring after and before dot

字串切割範例:

NSString *str = yourstr; 
NSArray *Array = [str componentsSeparatedByString:@"."]; 
NSString *t = [Array objectAtIndex:0]; 
NSString *t1 = [Array objectAtindex:1]; 

NSString *myString = @"app://ga/ecommerce/product:playstation4"; 
NSArray* spliteArray = [myString componentsSeparatedByString: @"/"];
NSString* lastString = [spliteArray lastObject];