PxPlus User Forum

Twitter Twitter Twitter

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

Jeffrey Ferreira

  • Diamond Member
  • *****
  • Posts: 138
    • 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

  • Administrator
  • Diamond Member
  • *****
  • Posts: 3713
  • Mike King
    • View Profile
    • PVX Plus Technologies
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.

Jeffrey Ferreira

  • Diamond Member
  • *****
  • Posts: 138
    • 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