【问题标题】:I have a lib ".a" file, where it contents some value,I am able to read the contents我有一个 lib ".a" 文件,其中包含一些值,我可以读取内容
【发布时间】:2011-11-22 18:23:21
【问题描述】:

我有一个 lib ".a" 文件,其中包含一些值。我能够阅读内容。但我想用逗号(,)替换空格并删除其中的第一个值。

例如,如果我的 .a 文件包含以下数据,

1 2 3

4 5 6

我希望通过以下方式输出,

2,3

5,6

所以我想从每个字符串中删除第一个值,并想用逗号(,)替换第二个和第三个值之间的空格。我该怎么做。

【问题讨论】:

    标签: iphone objective-c xcode


    【解决方案1】:

    也许对你有帮助!

    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);
    

    【讨论】:

    • @shasha 如果答案对您有帮助,您可以接受 na..?
    猜你喜欢
    • 2012-09-27
    • 1970-01-01
    • 2019-11-27
    • 2021-08-23
    • 1970-01-01
    • 2018-04-17
    • 1970-01-01
    • 1970-01-01
    • 2013-03-02
    相关资源
    最近更新 更多