[Gambas-user] Collection key

John Spikowski support at ...2529...
Wed Oct 12 20:45:12 CEST 2011


On Wed, 2011-10-12 at 21:31 +0300, Jussi Lahtinen wrote:
> You did it wrong.
> Gambas would interpret your keys this way:
> "A1234567"
> "B1234567"
> "C1234567"
> 
> Use reversed order, that way following keys are all same:
> "12345678A"
> "12345678B"
> "12345678C"
> 
> ---> "12345678"
> 
> Jussi

It doesn't seem to matter to SB.

IMPORT hash.bas

h = hash::New()
hash::SetValue(h,"1234567890A",1)
hash::SetValue(h,"12345678901234567890B",2)
hash::SetValue(h,"123456789012345678901234567890C",3)
hash::Start(h)

FOR x = 1 to 3
  PRINT hash::ThisKey(h), " - "
  PRINT hash::ThisValue(h),"\n"
  hash::Next(h)
NEXT x

hash::Release(h)

jrs at ...1833...:~/sb/test$ scriba testhash.sb
1234567890A - 1
12345678901234567890B - 2
123456789012345678901234567890C - 3
jrs at ...1833...:~/sb/test$ 






More information about the User mailing list