iphone - Creating an array from a text file read from a URL -
i reading text file url , want parse contents of file array. below snippet of code using. want able place each line of text next row of array. there way identify carriage return/line feed during or after text has been retrieved?
nsurl *url = [nsurl urlwithstring:ktexturl]; textview.text = [nsstring stringwithcontentsofurl:url encoding:nsutf8stringencoding error:nil];
when separating newline characters it's best use following procedure:
nscharacterset *newlines = [nscharacterset newlinecharacterset]; nsarray *linecomponents = [textfile componentsseparatedbycharactersinset:newlines];
this ensures lines separated either cr, cr+lf, or nel.
Comments
Post a Comment