Objective-C:修剪空白

时间:2010-11-09 14:40:12

标签: objective-c removing-whitespace

我必须遗漏一些东西。我正在尝试修剪从数组中提取的数据但我的应用程序在trim方法上崩溃了。

                //pull values
 NSString* thisXStr = [thisSetArray objectAtIndex:0];
 NSString* thisYStr = [thisSetArray objectAtIndex:1];

 //cleaning up all the white space
 NSString *thisXStrTrim = [thisXStr stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
 NSString *thisYStrTrim = [thisYStr stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];

2 个答案:

答案 0 :(得分:1)

尝试制作数组对象的副本: NSString * thisXStr = [NSString stringWithString:[thisSetArray objectAtIndex:0]]; ...

答案 1 :(得分:0)

废话,没关系,NSLog上的愚蠢语法错误...