Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Detecting new line character(s) in text file?



I am parsing subtitles file...(text subtitles for divx movies etc..)

Depending on the format they need to be parsed differently, but in any cases, I need to find out what linebreak character is used so I can parse them...



Shawn Erickson wrote:

On Nov 17, 2007, at 2:51 PM, Jean-Nicolas Jolivet wrote:

My application deals with text files... each line has to be parsed so I split it with

[str componentsSeparatedByString:@"\n"]

however..this only works if I have a text file that was saved on a mac... Is there an easy way to determine which new line character is used in a textfile (eighther linux, mac or win) and then use this for parsing afterward?

What are you trying? (not how you are currently trying to do it)

Consider -[NSString getLineStart:end:contentsEnd:forRange:]

Review...
<http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html#//apple_ref/doc/uid/20000154-DontLinkElementID_25>



-Shawn


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Detecting new line character(s) in text file? (From: Jean-Nicolas Jolivet <email@hidden>)
 >Re: Detecting new line character(s) in text file? (From: Shawn Erickson <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.