You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As AS3 is an OOP language, I find it odd that you chose to store the data in
Arrays. The data would be much easier to work with if you would store the data
as an Array filled with Objects, that have all the properties the header Array
has.
In my own instance of csvlib I've added these two functions, I hope you will
consider implementing something similair.
public function decodeToObject():void {
decode();
var dataArray:Array = data as Array;
var voList:Array = [];
var i:int;
var length:int = header.length;
for(i = 0; i <length; i++){
voList.push(toObject(dataArray[i]))
}
data = voList;
}
public function toObject(entry:Array):Object {
//the length of the entry should be the same as that of the header array
var vo:Object = new Object();
var i:int;
var length:int = header.length;
var propertyName:String;
for(i = 0; i < length; i++){
propertyName = header[i];
vo[propertyName] = entry[i];
}
return vo;
}
Original issue reported on code.google.com by t...@newnomads.nl on 19 May 2011 at 1:05
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
t...@newnomads.nl
on 19 May 2011 at 1:05The text was updated successfully, but these errors were encountered: