You should be able to use a RegExp
to do this. Something like:
var noLines:String = withLines.replace( /[\r\n]/g, "" );
That'll remove all new lines from your string; whether you want to do that before or after splitting it up to you.
If your string is in the form:
name1
name2
name3
Then you might even be able to get away with splitting using a RegExp
:
var names:Array = withLines.split( /[\r\n]/ );
You can test out the RegExp
provided here: http://regexr.com?38dmk (click on the replace tab and clear the replace input)