0

I want an array of 16 blank items

I don't want to

this.arConfig = ['','','','','','','','','','','','','','','','',''];

When I try

ArrayResize(this.arConfig, 16);

I get

enter image description here

Is there a way to cleanly load this. Note: I expect that someday 16 won't be enough.

James A Mohler
  • 11,060
  • 15
  • 46
  • 72
  • 3
    For very small arrays, an alternative to hard coding is: `listToArray(repeatString("'',",16));` – Leigh May 02 '15 at 02:18
  • What are you perceiving is actually *wrong* with what you're seeing there? You don't say. What was it you were expecting to see? Is it that you want to be able to access the array elements without a "Element n is undefined in a Java object of type class coldfusion.runtime.Array" exception, if you access element n before giving it a value? – Adam Cameron May 02 '15 at 06:59
  • I was hoping for blank strings – James A Mohler May 02 '15 at 17:04

1 Answers1

4

Just don't use ArrayResize() for such a small array. It is meant for LARGE arrays. Anyway, that's how it works, what do you expect? Anyway, there's ArraySet() if you really need it.

https://wikidocs.adobe.com/wiki/display/coldfusionen/ArraySet

Henry
  • 32,689
  • 19
  • 120
  • 221