PxPlus User Forum

Main Board => Discussions => Language => Topic started by: Jeffrey Ferreira on April 09, 2020, 03:21:23 PM

Title: Hexadecimal in Associative Array
Post by: Jeffrey Ferreira on April 09, 2020, 03:21:23 PM
Hello List,

is there any issue with putting hexadecimal values as the index of an associative array...
for example

dim LINE_ARRAY
LINE_ARRAY[$00FE00$]=1

It seems to work but am I asking for trouble?

Jeff
Title: Re: Hexadecimal in Associative Array
Post by: Mike King on April 09, 2020, 03:58:29 PM
There should not be any problem unless you plan to try and convert the array to JSON as the hex character values will not result in valid JSON variable names.

Internally the keys values for the associative arrays are maintained in a hash table that uses the string length and contents so it won't really care if the values are printable characters or not.
Title: Re: Hexadecimal in Associative Array
Post by: Jeffrey Ferreira on April 09, 2020, 04:13:43 PM
Thanks Mike,
i will get rid of my long compound strings and convert to associative arrays.
jeff