Hypesol EA
Hypesol EA

Reputation: 21

Breaking Array Values as Characters

I have an array with ascii characters values like this

arryAsc[] = [97, 100, 97, 115, 100]

Now I want to make an array arrSplit[] and want to save these values in array like this.

arrSplit[] = [9, 7, 1, 0, 0, 9, 7, 1, 1, 5, 1, 0, 0]

If anyone can help thanks in advance.

Upvotes: 1

Views: 21

Answers (2)

akmozo
akmozo

Reputation: 9839

You can simply do like this :

var a:Array = [97, 100, 97, 115, 100];

var b:Array = a.join('').split('');

trace(b);   // gives : 9,7,1,0,0,9,7,1,1,5,1,0,0

Hope that can help.

Upvotes: 1

Cadin
Cadin

Reputation: 4649

Loop through the array, casting each element as a String, then use split() with an empty string as delimiter to break apart each string into an array of characters. You can use concat to combine all the smaller arrays back into your larger arrSplit array.

Upvotes: 0

Related Questions