Creating an array from a text file read from a URL

I am reading a text file from a URL and want to parse the contents of the file into an array. Below is a snippet of the code I am using. I want to be able to place each line of the text into the next row of the array. Is there a way to identify the carriage return/line feed during or after the text has been retrieved?

NSURL *url = [NSURL URLWithString:kTextURL];
textView.text = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding                        error:nil];


When separating by newline characters it's best to use the following procedure:

NSCharacterSet *newlines = [NSCharacterSet newlineCharacterSet];
NSArray *lineComponents = [textFile componentsSeparatedByCharactersInSet:newlines];

This ensures that you get lines separated by either CR, CR+LF, or NEL.

Need Your Help

How to save a chart object created in loops

r graphics plot charts save

I have a chart created inside a couple of loops and I want to automatically write the chart to a file at the end of the outer loop. Here is a toy example:

PHP function respondes differently to submit after preventDefault()

php javascript jquery submit preventdefault

I'm using a PHP file (as part of a wordpress plugin), which contains several functions.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.