小编kra*_*ere的帖子

我的代码中处理nsstring的错误

我在这段代码中有错误

NSString *str = @"above string"; //load above string here
NSArray * firstArry = [str componentsSeparatedByString:@"#"];
NSMutableArray *secondArry = [[NSMutableArray alloc] init]; //Will hold the # titles
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init]; //Will hold the strings related to # title
for(NSString firstArryStr : firstArry)
{
    NSArray *tempArry = [firstArryStr componentsSeparatedByString@"\n"];
    NSMutableArray *titleStingsArry = [[NSMutableArray alloc] init];
    for (int i=0; i< [tempArry count];i++)
    {
        if (i==0)
        {
            NSString *title = [tempArry  objectAtIndex:i];
            [secondArry addObject:title];
            [dict setValue:titleStingsArry  forKey:title];
        } else { …
Run Code Online (Sandbox Code Playgroud)

iphone xcode objective-c uitableview nsstring

-1
推荐指数
1
解决办法
76
查看次数

替换NSString的值

我试图将NSString中月份的名称替换为其两位数字值的名称,例如"January"=>"01","February"=>"02".我使用的方法如下:

if (mois==@"january") { mois=@"01";}   
if (mois==@"February") { mois=@"02";}
Run Code Online (Sandbox Code Playgroud)

......但它不起作用.我该怎么做这个替换?

iphone objective-c nsstring

-1
推荐指数
1
解决办法
138
查看次数

标签 统计

iphone ×2

nsstring ×2

objective-c ×2

uitableview ×1

xcode ×1