从关联数组中删除元素
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了从关联数组中删除元素相关的知识,希望对你有一定的参考价值。
/** * * @param $obj The object you want to delete elements from * @param parameters A comma delimeter parameters to be passed on the object for deletion, if a parameter is not found the object it will be skipped * @return The new object with the deleted element * */ public static function deleteElements ($obj:Object, ...parameters):Object { if ($obj != {} || $obj != null) { for (var s:String in parameters) { if ($obj[parameters[s]] && $obj[parameters[s]] != undefined) { $obj[parameters[s]] = null; delete $obj[parameters[s]]; } else { trace ("parameter,", parameters[s], "was skipped as it couldn't be found on the object"); } } } return $obj; }
以上是关于从关联数组中删除元素的主要内容,如果未能解决你的问题,请参考以下文章