OC 数组里面包含几种重复字段,将重复字段分类到另一数组

// 该数组包含重复字段
   NSMutableArray *StudentTableArr = [[PAFMDBManager shareInstance] findAll:@"StudentTable2" StudentExamination_no:nil StudentLocation_ID:nil StudentRomm_ID:nil];
    

    NSMutableArray *dateMutablearray = [[NSMutableArray alloc] init];

    for (int i = 0; i < StudentTableArr.count; i ++) {
        
        PAStudentModel *model = StudentTableArr[ i];
        
        NSMutableArray *tempArray = [[NSMutableArray alloc] init];
        
        NSString *istring = model.Examination_no;
        
        [tempArray addObject:istring];
        
        for (int j = i+1; j < StudentTableArr.count; j ++) {
            
            PAStudentModel *model= StudentTableArr[j];
            
            NSString *jstring = model.Examination_no;
            NSLog(@"jstring:%@",jstring);
            
            if([istring isEqualToString:jstring]){
                
                NSLog(@"jvalue = kvalue");
                
                [tempArray addObject:jstring];
                
                [StudentTableArr removeObjectAtIndex:j];
                  j = j -1;
            }
        }
        [dateMutablearray addObject:tempArray];
    }````

你可能感兴趣的:(OC 数组里面包含几种重复字段,将重复字段分类到另一数组)