Skip to main content
Participant
Oct 23, 2024 8:14 AM UTC
Answered

String Characters are removed from String array

Hello,
I have defined a String array and would like to iterate through the entries: 

var evArr: Array = new Array("empty", "ev1", "ev2", "ev3", "ev4", "ev5", "ev6", "ev7", "ev8", "ev9", "ev10", "ev11", "ev12", "ev13", "ev14", "ev15", "ev16", "ev17"); 

var countEvs:Number = 17;

var concatArray: String;
var i:Number;	
for (i = 1; i <= countEvs; i++) {
	concatArray= concatArray+ evArr[i];
}
textField.text = concatArray;


As a result I get:
"nulle1e2e3ee5e6e7eee1e11e12e13e1e15e16e17"

Does anyone know why are the "v"s removed? Why is there a problem with the numbers 4, 8, 9, 10, 14?

Thank you a lot in advace!

This topic is closed to new replies. Start a new post to keep the conversation going.
JoãoCésar17023019
JoãoCésar17023019Correct answer
Community Expert
Oct 23, 2024 11:15 AM UTC

Hi.

 

You should initialize concatArray as "". Other than that, if you're not seeing those characters, the font family you're using is probably not embedded.

 

But if all you want to do is to display the items from the array, starting from the index 1, in a text field, I think it's eaiser to use some methods from the Array class. For example:

 

textField.text = evArr.slice(1).join("");

 


Regards,

JC

3 replies

JoãoCésar17023019
Community Expert
JoãoCésar17023019Community ExpertCorrect answer
Community Expert
Oct 23, 2024 11:15 AM UTC

Hi.

 

You should initialize concatArray as "". Other than that, if you're not seeing those characters, the font family you're using is probably not embedded.

 

But if all you want to do is to display the items from the array, starting from the index 1, in a text field, I think it's eaiser to use some methods from the Array class. For example:

 

textField.text = evArr.slice(1).join("");

 


Regards,

JC

Translate
Participant
Oct 23, 2024 11:44 AM UTC

Hi,
Thanks for the tip regarding the font, it was indeed the reason. A different font worked!
Best regards

Translate
JoãoCésar17023019
Community Expert
Community Expert
Oct 23, 2024 11:49 AM UTC

Nice! You're welcome.

Translate