我在一个简单的程序中工作,在该程序中我拆分了一个字符串和一个全局用户,我使用下面的代码拆分字符串。字符串拆分问题
NSString *GlobleStr;//globale variable
//===============
NSString *[email protected]"Apple,iphone";
NSArray *array = [xmlParsingResult componentsSeparatedByString:@","];
NSString *StrResult = [NSString stringWithFormat:@"%@", [array objectAtIndex:0]];
GlobleStr =[NSString stringWithFormat:@"%@",[array objectAtIndex:1]];
NSLog(@"cmd %@",StrResult);
NSLog(@"value%@",GlobleStr);
我的代码可以分割字符串和O/P是cmd:苹果值:iphone
但我的问题是,只要我调用另一个厦门国际银行,然后我的全局变量将是空的或零和该应用程序将崩溃(它会抛出error like Variable is not cfstring
)。
有什么建议吗?
编辑you code formate – 2010-09-20 13:13:05