Hexadecimal in Associative Array

Started by Jeffrey Ferreira, April 09, 2020, 03:21:23 PM

Previous topic - Next topic

Jeffrey Ferreira

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

Mike King

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.
Mike King
President - BBSysco Consulting - http://www.bbsysco.com
eMail: mike.king@bbsysco.com

Jeffrey Ferreira

Thanks Mike,
i will get rid of my long compound strings and convert to associative arrays.
jeff