Hdel » History » Version 5
Per Amundsen, 02/16/2023 12:44 PM
1 | 1 | Per Amundsen | _Added in 1.9.0_ |
---|---|---|---|
2 | |||
3 | */hdel [-sw] <name> <item>* |
||
4 | |||
5 | Deletes an item from a hash table. |
||
6 | |||
7 | 4 | Per Amundsen | _See also [[/hsave]], [[/hload]], [[/hmake]], [[/hfree]], [[$hget]], [[$hfind]]._ |
8 | |||
9 | 1 | Per Amundsen | *Switches* |
10 | |||
11 | 5 | Per Amundsen | table(ktable). |
12 | |*Switch*|*Description*| |
||
13 | | -s | Displays the result. | |
||
14 | | -w | Indicates item is a [[Scripting_Wildcards<notextile>|</notextile>wildcard]]. | |
||
15 | 1 | Per Amundsen | |
16 | *Parameters* |
||
17 | |||
18 | 5 | Per Amundsen | table(ktable). |
19 | |*Parameter*|*Description*| |
||
20 | | <name> | The hashtable to delete from. | |
||
21 | | <item> | The hashtable item to delete. | |
||
22 | 1 | Per Amundsen | |
23 | *Example* |
||
24 | |||
25 | <pre> |
||
26 | alias example { |
||
27 | 2 | Per Amundsen | ; Create a hash table |
28 | 1 | Per Amundsen | /hadd -m example academic a |
29 | 2 | Per Amundsen | |
30 | ; Add some items to the hash table.. |
||
31 | 1 | Per Amundsen | /hadd example academy a |
32 | /hadd example accelerate a |
||
33 | /hadd example accelerator a |
||
34 | /hadd example accept a |
||
35 | /hadd example access a |
||
36 | /hadd example accident a |
||
37 | /hadd example because b |
||
38 | |||
39 | 2 | Per Amundsen | ; Print number of items. |
40 | //echo -a $hget(example, 0).item |
||
41 | 1 | Per Amundsen | |
42 | 2 | Per Amundsen | ; Remove everything matching wildcard 'a*'. |
43 | 1 | Per Amundsen | /hdel -w example a* |
44 | |||
45 | 2 | Per Amundsen | ; Print number of items. |
46 | //echo -a $hget(example, 0).item |
||
47 | 1 | Per Amundsen | |
48 | 2 | Per Amundsen | ; Free table. |
49 | 1 | Per Amundsen | /hfree example |
50 | } |
||
51 | </pre> |