我编写了一个代码,它将内容从字符串中分离出来,检查内容是否将引号作为第一个字符,然后将它们组合回两个字符串:一个以引号开头,一个不以引号开头。我有以下代码,但是当我运行它时,它似乎没有检测到引号。
NSArray *detailTextLabelContentArray = [[NSArray alloc] initWithObjects:@"Some",@"Good",@"Stuff",@"\"Lazy\"", nil];
for (NSInteger index = 0; [detailTextLabelContentArray count] > index; index++)
{
if ([[detailTextLabelContentArray objectAtIndex:index] substringToIndex:1] != @"\"")
{
if (index == 0)
{
detailTextLabelContent = [[detailTextLabelContentArray objectAtIndex:index] substringToIndex:1];
}
else
{
detailTextLabelContent = [NSString stringWithFormat:@"%@; %@",detailTextLabelContent,detailTextLabelContent = [[detailTextLabelContentArray objectAtIndex:index] substringToIndex:1]];
}
}
}
NSLog(detailTextLabelContent);
我在这里做错了吗?