PxPlus User Forum

Twitter Twitter Twitter

Author Topic: Hexadecimal in Associative Array  (Read 981 times)

Jeffrey Ferreira

  • Diamond Member
  • *****
  • Posts: 175
  • I must have taken a wrong turn at Albuquerque.
    • View Profile
Hexadecimal in Associative Array
« 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

Mike King

  • Diamond Member
  • *****
  • Posts: 3810
  • Mike King
    • View Profile
    • BBSysco Consulting
Re: Hexadecimal in Associative Array
« Reply #1 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.
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com

Jeffrey Ferreira

  • Diamond Member
  • *****
  • Posts: 175
  • I must have taken a wrong turn at Albuquerque.
    • View Profile
Re: Hexadecimal in Associative Array
« Reply #2 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