var idPage:Array = [];
function checkCategory(category:String, object:Object):Void {
if (idPage[category]) {
idPage[category].push(object);
// insert the new item into the category list
} else {
// category DOES NOT exist
idPage[category] = [object];
// create an array and insert the object
}
}
//objects
checkCategory("google",{title:"google", links:"http://www.google.com", date:"20060215"});
checkCategory("yahoo",{title:"yahoo", links:"http://www.yahoo.com", date:"20070123"});
checkCategory("microsoft",{title:"vista", links:"http://www.microsoft.com", date:"20070521"});
checkCategory("yahoo",{title:"flickr", links:"http://www.flickr.com", date:"20070607"});
checkCategory("google", {title:"youtube", links:"http://www.youtube.com", date:"20070712"});
checkCategory("yahoo||ludricorp",{title:"del.icio.us", links:"http://del.icio.us", date:"20051011"});
checkCategory("google||pyralabs",{title:"blogspot", links:"http://www.blogspot.com", date:"20060215"});
//
for (var categoryList in idPage){
trace("+ "+categoryList)
for(var catTitle in idPage[categoryList]) {
trace(" - "+ idPage[categoryList][catTitle].title)
}
//out put
+ google||pyralabs
- blogspot
+ yahoo||ludricorp
- del.icio.us
+ microsoft
- vista
+ yahoo
- flickr
- yahoo
+ google
- youtube
- google
}
Hi… I need some direction… how do I spilt the google||pyralabs and yahoo||ludricorp into it’s own string and if they have the same string, then will merge with it? Wanting to get the output into this
+ pyralabs
- blogspot
+ ludricorp
- del.icio.us
+ microsoft
- vista
+ yahoo
- flickr
- yahoo
- del.icio.us
+ google
- youtube
- google
- blogspot
Please?