# How to merge array with dictionary?

**URL:** <https://forum.kirupa.com/t/how-to-merge-array-with-dictionary/284556>\
**Category:** Uncategorized\
**Created:** [March 20, 2009, 6:06am UTC](https://forum.kirupa.com/t/how-to-merge-array-with-dictionary/284556 "2009-03-20T06:06:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexeioleynik](https://avatars.discourse-cdn.com/v4/letter/a/e19b73/32.png) [@alexeioleynik](https://forum.kirupa.com/u/alexeioleynik)\
**Post date:** [March 20, 2009, 6:06am UTC](https://forum.kirupa.com/t/how-to-merge-array-with-dictionary/284556/1 "2009-03-20T06:06:11Z")

</div>

Hi,

I have an ARRAY which contains single symbols and DICTIONARY in where every symbol in array is attached to unique string, what I want to do - is to merge ARRAY and DICTIONARY together, and as a result receive RESULT\_ARRAY where order of elements is equal to ARRAY but elements are replaced according to a DICTIONARY.

```auto
//for example
//this is what we have -
var originalA:Array = new Array ();
originalA[0]="y";
originalA[1]="t";
originalA[2]="r";
originalA[3]="e";
originalA[4]="w";
originalA[5]="q";
var dict:Dictionary = new Dictionary();
dict["q"]="text fragment q";
dict["w"]="text fragment w";
dict["e"]="text fragment e";
dict["r"]="text fragment r";
dict["t"]="text fragment t";
dict["y"]="text fragment y";

//and this is what we want to receive -
var originalA:Array = new Array ();
originalA[0]="text fragment y";
originalA[1]="text fragment t";
originalA[2]="text fragment r";
originalA[3]="text fragment e";
originalA[4]="text fragment w";
originalA[5]="text fragment q";

```
