0
我想使用多維數組。任何人都可以解釋如何在iPhone應用程序中使用它?我是Objective-C的新手。如何實現Multidimention數組
這裏就是我想要做的事:
- 我劈裂seprator的基礎上,主串和陣列中的存儲。
- 用新的子字符串和新值替換此數組的每個元素的某些內容將存儲在新數組中。
- 想要再次使用新的分析器分割新陣列的每個元素,並且想要將這個新值存儲在新陣列中 ,前提是這將是使用多維度的eassy。
感謝, Aaryan
(代碼我到目前爲止)
- (void)viewDidLoad {
[super viewDidLoad];
NSMutableArray *arrSeprate = [[NSMutableArray alloc]init];
NSString *temp;
// it is a mysql query//
insertqry = @"INSERT INTO `userDecks` VALUES (1,2,618),(1,3,1471),(1,4,0),(1,5,0),(1,6,7784),(1,11,0),(1,12,469),(1,13,0),(1,16,0),(1,17,113),(1,18,0),(1,19,752),(1,20,60),(1,21,0),(1,30,0),(1,31,0),(1,32,159),(1,34,129),(1,46,143),(1,47,0),(1,53,105),(1,55,456),(1,65,0),(1,66,127),(1,67,131)";
//step-1 ----------begin--------
NSArray *listItems = [insertqry componentsSeparatedByString:@"),"];
//step-1 ----------end--------
int i=0;
//step-2 ----------begin--------
for (i = 1; i<[listItems count]; i++)
{
temp = [listItems objectAtIndex:i];
temp = [temp stringByReplacingOccurrencesOfString:@"(" withString:@"INSERT INTO `userInvitation` VALUES ("];
[arrSeprate addObject:temp];
}
//step-2 ----------end-------------
//step-3 ----------begin--------this will use the for loop to ll elemts of previous array
NSString *middleqry = [arrSeprate objectAtIndex:0];
NSArray *ItemsArray = [middleqry componentsSeparatedByString:@","];
NSLog(@"%@",ItemsArray);
}
目前尚不清楚預期的最終結果。 – zaph 2009-09-17 20:44:48
thx, 獲得瞭解答 – user145883 2009-09-23 20:04:28