Languages Delphi & Kylix Delphi Delphi function enhancement  

THash

download download  
important code information
author:
Luu Tran
minimum requirements:
THash description

THash works like Perl's associative array, i.e., an array indexed by a Key of type string with an associated Value of type Pointer, which means Value is anything that will fit into a Pointer type -- you just need to do the appropriate typecasting.

There is a default hash size (number of buckets) of 17, so you can start adding items right away if you wish. By default, I double the hash size and rebuild it whenever number of items > 2 x number of buckets. The rebuild is
expensive and best avoided by setting an appropriate hash size at the outset. As usual, there's a speed vs. space tradeoff. Note: you can turn off the automatic resize feature by setting AutoGrow to false.

You can add an item or change its value by simply assigning to the hash. (Just like an array) You can delete an item by assigning NIL as its value or use the explicit .Delete method. You can also explicitly add with the Add method. The Add method does not check whether the item already exists so it is slightly faster; it's useful when you are populating the hash at the start. There is also an explicit Delete method.



File List:
hash-readme.txt5Kb
hash.pas19Kb

Similar code
The art of Delphi - Date to Word (Popularity: ) : Convert Dates to 16 bit(Word) variables
TableCopyV2 (Popularity: ) : TableCopyv2.. so smart..nice to use..helpful. Have you ever copied Field names from a table "Fields Editor" to use it with 'FieldByName' command to put a data or edit a field value. This smart program tranforms copied text from a "Field ...
JDStrings (Popularity: ) : This are some useful string functions that I often use in my programs. It contains following functions: Function StrPaste (SourceString:string; SearchString:string; ReplaceString:string): string; { paste part of a string with another string } Function StrDel (SourceString:string; DeleteString:string): string; { delete ...
Lite Registry 1.1 (Popularity: ) : Lite Registry 1.1 unit brings the power of the TRegistry class to your application by adding only 3 KBs to your EXEcutable files instead of 120 KB while using the TRegistry Class ! You can Read/Write DWORD or String, Delete ...
TLanguageChanger (Popularity: ) : This is a delphi component for handeling Windows Virtual Keyboard layouts. You can retrive list of existed layouts, change them and retrive information about each layout.
Stringsplit Procedure (Popularity: ) : It works as the Visual Basic Split function

Please Rate me .

IntToStr and StrToInt (Popularity: ) : Using this unit, you can convert String or a PChar to an unsigned DWORD or a signed Integer. The purpose of the code is to demonstrate the conversion's steps. The code has explanation and comments.
TableCopy (Popularity: ) : So smart..nice to use..helpful.. Have you ever copied Field names from a table "Fields Editor" to use it with 'FieldByName' command to put a data or edit a field value. This smart program tranforms copied text from a "Field Editor" ...
ShellNotifyIcon (Popularity: ) : This component allows you to add animated icons to the Windows system tray. Use Popup Menu’s without writing a single line of code. Support for the following Mouse Events: OnDblClick, OnMouseDown and OnMouseUp.
User reviews

Write a review:
1 2 3 4 5 6 7 8 9 10
1=poor 10=excellent
Write review*
Your name*
Email*
  (Comments are moderated, and will not appear on this site until the editor has approved them)
 
Rate me
supported os
stats
downloads 67
version
size in Kb 9
popularity   1686/7913373
user rating 6/10
ad


New Code
Popular Code