<< Click to Display Table of Contents >> Navigation: ThinBASIC Modules > Obsolete > Dictionary > Dictionary_Create |
Description
Creates a new dictionary and returns a pointer. Use this pointer for all subsequent operations on that specific dictionary.
Syntax
pDictionary = Dictionary_Create(NumberOfKeys [, KeyIsUcase])
Returns
Number: pointer to a dictionary object
If Zero = error.
Parameters
Name |
Type |
Optional |
Meaning |
NumberOfKeys |
Numeric |
No |
Max number of keys. |
KeyIsUcase |
Numeric |
Yes |
If %TRUE, all keys will be considered case insensitive otherwise exact comparison will be performed when searching and during storing of key/data pairs |
Remarks
A typical situation is to create a dictionary with NumberOfKeys = NeededKeys * 2
So if you need to store about 1000 unique keys, create a dictionary of at least 2000 keys.
More than NumberOfKeys keys can be stored into a dictionary but this will slow down all operations.
Restrictions
See also
This functionality has been made obsolete by newer, better optimized hash table available directly in core instead.
Examples
USES "dictionary"
Dim pDict As Long '---Pointer to dictionary
Dim counter As Long
pDict = Dictionary_Create(1000000, %TRUE)
For counter = 1 To 100000
Dictionary_Add(pDict, counter, String$(100, Counter))
Next
MSGBOX 0, "Add OK"
MSGBOX 0, "Data key = 1000 is: " & LEFT$(Dictionary_Find(pDict, 1000),10) & " ..."
Dictionary_Free(pDict)