Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

FreedomApple

macrumors newbie
Original poster
Hello everyone,
I'm new to Objective C. What I'm trying to do is pull a list from my site that comes out like this:

Code:
item 1<br>\n
item 2<br>\n
item 3<br>\n
etc<br>\n

And using the code below it all comes out on one line when I want it to be split.

Code:
    NSString *theWebString = @"http://mysite.com/getlist.php";
    NSURL *theWebURL = [NSURL URLWithString:theWebString];
    NSError *error;
    NSString *theWebPage = [NSString stringWithContentsOfURL:theWebURL 
                                                    encoding:NSASCIIStringEncoding
                                                       error:&error];
    NSArray *lines = [theWebPage componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"\r\n"]];
    for (NSString* line in lines) {
        if (line.length) {
            NSLog(@"line: %@", line);
        }


Anyone have any ideas how I would go about doing this?

Thanks in advanced.
 
Figured it out by doing the following

Code:
NSArray *lines = [theWebPage componentsSeparatedByString:@"<br>"];
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.