views:

44

answers:

0

Hi,

I have the following loop which builds an array from characters in a string (the additional @ is there deliberately)

NSString *testString = @"@the quick brown fox jumps over the lazy dog";


NSMutableArray *characters = [[NSMutableArray alloc] initWithCapacity:[testString length]];
for (int i=0; i < [testString length]; i++) {
    NSString *ichar  = [NSString stringWithFormat:@"%C", [testString characterAtIndex:i]];

    [characters addObject:[ichar uppercaseString]];
    NSLog(@"ichar is: %@",[ichar uppercaseString]);
}

The individual characters are added to CATextLayers in their string property and when I test for equality elsewhere, an animation loop finishes. This works fine for everything except the spaces.

if ([nextLayer.string isEqualToString:endChar]) {

However, if the string is a space (@""), this comparison never evaluates to true.

Can anyone suggest why?