[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];

 

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *