var lines : Array = (str.indexOf( "\r\n" ) > -1) ? str.split( "\r\n" ) : str.split( "\n" );
Or, if you want to take MacOS 9 into account: var lines : Array; if( str.indexOf( "\r\n" ) > -1 ) { lines = str.indexOf( "\r\n" ); } else if( str.indexOf( "\n" ) > -1 ) { lines = str.split( "\n" ); } else if( str.indexOf( "\r" ) > -1 ) { lines = str.split( "\r" ); } else { lines = str; } (You don't actually need the "default", splitting on a non-existing string should return an array of length 1. It's just more clear that way.) HTH, Mark On 9/12/07, Danny Kodicek <[EMAIL PROTECTED]> wrote: > I'm looking for a simple, reliable method for splitting a string into its > constituent lines (at the hard line breaks - this isn't a text wrapping > thing). The problem is that line breaks could be Chr(10) or Chr(13), or > indeed both. I've done this: > myArr = > myStr.split(String.fromCharCode(10)).join(String.fromCharCode(13)).split(Str > ing.fromCharCode(13)) > > I'm guessing I'm better off going the RegEx route, but I was wondering if > there's a quicker, simpler way. > > Danny > > _______________________________________________ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com > _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com