views:

58

answers:

2

My strings are fine, but when they get added to an array a weird grouping of "\n\t\t" gets added to the end. So the string "Apple", becomes "Apple\n\t\t" when I look at the array description.

Whats the deal with that? and how do I fix it?

Addition:

Its XML code. It seemed like [currentPlace appendString:string]; would get the right part, then add the \n\t\t next time round. I solved this by alternating using a boolean:

    if (alternate == NO) {
        [currentPlace appendString:string];
        alternate = YES;
    }   else {
        alternate = NO;
    }

Is there a better way to alternate? I remember there being a case + break way, but I forget how to do it.

+1  A: 

Adding strings to an array obviously does not modify their contents. Your bug is somewhere else, a part of your program you did not describe. Without code, nobody would be able to help you.

Nikolai Ruhe
A: 

I solved this by adding a switch to:

- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string;

All is good now.

Zac Altman