NSMutableArray*array = [[NSMutableArray alloc]init];
NSArray*Somearray = [NSArray arrayWithObjects:1st Object,2ndObject,3rd Object,4th object,5th Object,nil];
上記の配列では、第1オブジェクト、第2オブジェクト、第3オブジェクト、第4オブジェクト、第5オブジェクトの各インデックスにval、content、結論があります。NSArrayでインデックスを取得するには?
for(int i=0;i<[Somearray count];i++)
{
______________
Here the code is there to give each index ,that is having val,content,conclusion ..
After that val,content,conclusion in each index will be add to Dict..
____________
NSDictionary *Dict = [NSDictionary dictionaryWithObjectsAndKeys:val,@"val",content,@"content",conclusion,@"conclusion",nil];
//Each time adding dictionary into array;
[array addObject:Dict];
}
上記辞書forループ内にあり、キー値ペアが.Nowアレイは今私は今NSString*string = @"1.5";
を有してい
array = [{val="1.1 this is first one",content="This is the content of 0th index",conclusion="this is the conclusion of 0th index"},{val="1.2 this is first one",content="This is the content of 1st index",conclusion="this is the conclusion of 1st index"},____,____,______,{val="1.5 this is first one",content="This is the content of 4th index",conclusion="this is the conclusion of 4th index"},nil];
に有している(Somearrayカウント)5回を追加します私はvalがit.Howにインデックスを見つけるために配列にstrを送るために持っているインデックスが必要です。
誰でもコードを共有できますか。
ありがとうございます。
プレフィックスメソッドを持ってい – Univer
'[[ id objectForKey:@ "val"] hasPrefix:@ "1.5"] '[NSString Class Reference](http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class)を確認してください。 /Reference/NSString.html#//apple_ref/occ/instm/NS String/hasPrefix:)*。 –