My approach would be to load all the rows and parse the // characters as a 
column, get a count of rows where that column is not empty, and then delete 
them.

--- In flexcoders@yahoogroups.com, "~[TM3]~[Dev]At0ng[/Dev]~[/TM3]~" 
<atong...@...> wrote:
>
> 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)
>


Reply via email to