I recently have this code from gotoandlearnforums to parse datas separated with commas from a text file but the problem is I dunno (I really had no idea how) how to exclude rows that begins with a double slashes (//), hope someone can help me with this. Parsing datas is ok but excluding rows is not private function init(e:Event):void { //load the data var loader:URLLoader = new URLLoader(new URLRequest("stuff.txt")); loader.addEventListener(Event.COMPLETE, parseData); } private function parseData(e:Event):void { var txt:String = e.target.data; var rows:Array = txt.split("\r\n");//split the string into rows var temp:Array = new Array(); for(var i:int = 0; i<rows.length; i++) { //you would include an if statement here to not include lines that begin with // var columns:Array = rows[i].split(",");//split each row into columns temp.push({id:columns[0],name:columns[1],position:columns[2]}); } ac = new ArrayCollection(temp)
[flexcoders] [HELP] Little help with parsing datas
~[TM3]~[Dev]At0ng[/Dev]~[/TM3]~ Sat, 23 Jan 2010 05:42:12 -0800
- [flexcoders] [HELP] Little help with parsi... ~[TM3]~[Dev]At0ng[/Dev]~[/TM3]~