/*按照第一个字符排序*/
-(NSMutableArray*) SortAsFirstChar:(NSMutableArray*)pFriendListArray
{
NSMutableArray* pArray = [[NSMutableArray alloc] init];
while(pFriendListArray.count > 0)
{
NSString* pName = ((UserFriendItem*)[pFriendListArray objectAtIndex:0])->pstrName;
for(int i = 0;i < pFriendListArray.count; ++i)
{
if(NSOrderedSame == [((UserFriendItem*)[pFriendListArray objectAtIndex:i])->pstrName compare:pName])
{
[pArray addObject:[pFriendListArray objectAtIndex:i]];
}
}
while(true)
{
int i = 0;
for(;i < pFriendListArray.count; ++i)
{
if(NSOrderedSame == [((UserFriendItem*)[pFriendListArray objectAtIndex:i])->pstrName compare:pName])
{
[pFriendListArray removeObjectAtIndex:i];
break;
}
}
if(i == pFriendListArray.count)
{
break;
}
}
}
return pArray;
}
网友评论