how to add concatenate multiple NSString in one String in iphone

后端 未结 6 1315
有刺的猬
有刺的猬 2020-12-31 08:19

I have 5 String i want that they must be store in singe NSString all the values separate with | sign

   NSString *first=@\"Ali\";
   NSString *         


        
6条回答
  •  离开以前
    2020-12-31 09:00

    NSArray *stringsArray = [[NSArray alloc] initWithObjects:first, second, third, fourth, fifth, nil];
    NSString *combinedString = [stringsArray componentsJoinedByString:@","];
    

    The combined String looks like this @"Ali,Imran,AliImran,ImranAli,Ali Imran Jamshed";

提交回复
热议问题