Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 如何从字符串中删除特定符号?_Iphone_Objective C_Nsstring - Fatal编程技术网

Iphone 如何从字符串中删除特定符号?

Iphone 如何从字符串中删除特定符号?,iphone,objective-c,nsstring,Iphone,Objective C,Nsstring,我有一根绳子 gpbusd~buy~~~~~更新~HIT 40 PIPS~达到110 PIPS~~gpbusd~buy~~~收支平衡~update~HIT~100+~~gpbusd~buy~1.5500/25~1.5455~~new~40~100+~~gpbusd~buy~~~更新~0到10 PIPS N~~gpbusd~buy~1.5335/50~1.5320~~new~40~80+~gpbusd~15-20 PIPS~更新~15-20 PIPS关闭~gpbusd~1.5530/50~继续更新

我有一根绳子

gpbusd~buy~~~~~更新~HIT 40 PIPS~达到110 PIPS~~gpbusd~buy~~~收支平衡~update~HIT~100+~~gpbusd~buy~1.5500/25~1.5455~~new~40~100+~~gpbusd~buy~~~更新~0到10 PIPS N~~gpbusd~buy~1.5335/50~1.5320~~new~40~80+~gpbusd~15-20 PIPS~更新~15-20 PIPS关闭~gpbusd~1.5530/50~继续更新~打开~gpbusd~购买~1.5530/50~1.5465~~new~40~80~100+~gbpjpy~卖出~131.05/.130.75~132.15~~new~60~100~继续打开~euruUSD~卖出~1.2840/20~1.2870~停止~update~~~~~

我想删除delimeter标志并将它们之间的所有文字分开?我该如何做?

  • 拆分字符串:

    NSArray *parts = [string componentsSeparatedByString: @"~"];
    
  • 从数组中组装字符串:

    NSString *string = [parts componentsJoinedByString: @" "];
    
  • 通过将所有出现的
    ~
    替换为空白来清理字符串:

    NSString *string = [string stringByReplacingOccurrencesOfString: @"~"\
                               withString:@" " ]
    
      • 拆分字符串:

        NSArray *parts = [string componentsSeparatedByString: @"~"];
        
      • 从数组中组装字符串:

        NSString *string = [parts componentsJoinedByString: @" "];
        
      • 通过将所有出现的
        ~
        替换为空白来清理字符串:

        NSString *string = [string stringByReplacingOccurrencesOfString: @"~"\
                                   withString:@" " ]
        

      如何制作字符串单词数组?如何制作字符串单词数组?