0
在我的iPhone應用程序中,我有一串蜇傷。如何在不區分大小寫的情況下從字符串數組中獲取第一個字符集
從字符串我需要得到第一個字符串的數組。爲此,我已經實施了以下邏輯。它的作品,但在這個我已經檢索charectes twicw 1.小寫字母和2.Capital字母。
即使是小寫字母,我也只需要大寫字母。
只喜歡「A」爲美洲,非洲和美洲,antantica
contactIndex = [[NSMutableArray alloc] init];
for (int i=0; i<[contactsArray count]-1; i++){
//---get the first char of each state---
char alphabet = [[contactsArray objectAtIndex:i] characterAtIndex:0];
NSString *uniChar = [NSString stringWithFormat:@"%C", alphabet];
//---add each letter to the index array---
if (![contactIndex containsObject:uniChar])
{
[contactIndex addObject:uniChar];
}
}