I have a lib “.a” file, where it contents some val

2019-10-03 04:43发布

问题:

I have a lib ".a" file, where it contents some value. I am able to read the contents.But I want replace the space with the Comma(,) and remove the first value in it.

For Example if my .a file Contents the following data,

1 2 3

4 5 6

I want the Output in the following way,

2,3

5,6

So i want to remove the first value from each string and want to replace the Space between the second and third values with a Comma(,).How can I do this.

回答1:

It's may help you!

NSString *str=@"1 2 3";
NSArray *split = [str componentsSeparatedByString:@" "];
NSString *replacevalue=@" ";
for(int i=1;i<[split count];i++)
   {
     if([replacevalue isEqualToString:@" "])
        replacevalue=[NSString stringWithFormat:@"%@",[split objectAtIndex:i]];
     else
        replacevalue=[NSString stringWithFormat:@"%@,%@",replacevalue,[split objectAtIndex:i]];
   }

NSLog(@"%@",replacevalue);