$hfind » History » Version 21
Per Amundsen, 06/07/2023 08:31 PM
| 1 | 1 | Per Amundsen | _Added in 1.9.0_ |
|---|---|---|---|
| 2 | |||
| 3 | 20 | Per Amundsen | *$hfind(name|N,text,[N],[options],[@window|command])* |
| 4 | 1 | Per Amundsen | |
| 5 | Searches table for the Nth item name which matches text and returns the item name. |
||
| 6 | |||
| 7 | 10 | Per Amundsen | _See also [[/hsave]], [[/hload]], [[/hmake]], [[/hfree]], [[/hdel]], [[$hget]]._ |
| 8 | |||
| 9 | 11 | Per Amundsen | _See also [[$hmatch]], [[$hregex]]._ |
| 10 | 7 | Per Amundsen | |
| 11 | 1 | Per Amundsen | *Parameters* |
| 12 | |||
| 13 | 20 | Per Amundsen | table(ktable). |
| 14 | |*Parameter*|*Description*| |
||
| 15 | | name<notextile>|</notextile>N | Name of the hash table or the Nth hash table. | |
||
| 16 | | text | Text to search for. | |
||
| 17 | | [N] | If N = 0, number of matches, otherwise the Nth match. (optional) | |
||
| 18 | | [options] | Options. | |
||
| 19 | | [@window<notextile>|</notextile>command] | if @window is defined, fills the side-listbox with the results, otherwise the command is run on each result. | |
||
| 20 | 1 | Per Amundsen | |
| 21 | 20 | Per Amundsen | *Options* |
| 22 | 1 | Per Amundsen | |
| 23 | 20 | Per Amundsen | table(ktable). |
| 24 | |*Option*|*Description*| |
||
| 25 | | n | Normal text comparison. (default if M is not specified) | |
||
| 26 | | w | Text is wildcard text. | |
||
| 27 | | W | Hash table item/data is wildcard text. | |
||
| 28 | | r | Text is a regular expression. | |
||
| 29 | | R | Hash table item/data is a regular expression. | |
||
| 30 | | N | Use case-sensitive match. *(AdiIRC only)* | |
||
| 31 | 21 | Per Amundsen | | H | /halt *will* halt the running script if used inside the [command]. *(AdiIRC only)* | |
| 32 | 20 | Per Amundsen | |
| 33 | 4 | Per Amundsen | *Properties* |
| 34 | 1 | Per Amundsen | |
| 35 | 20 | Per Amundsen | table(ktable). |
| 36 | |*Property*|*Description*| |
||
| 37 | | .data | Search for a matching data value instead of item name. | |
||
| 38 | 1 | Per Amundsen | |
| 39 | *Example* |
||
| 40 | |||
| 41 | <pre> |
||
| 42 | ; Searches hash table 'Example' for all items using and runs the command 'echo -ag $1-' on each result, $1- holds the item name or data. |
||
| 43 | //echo -ag result: $hfind(Example, *, 0, w, echo -ag $1-) |
||
| 44 | |||
| 45 | ; Searches the hash table 'Example' and prints the number of matches. |
||
| 46 | //echo -ag result: $hfind(Example, *, 0, w) |
||
| 47 | |||
| 48 | ; Searches the hash table 'Example' and prints the first matched item. |
||
| 49 | //echo -ag result: $hfind(Example, *, 1, w) |
||
| 50 | |||
| 51 | ; Searches the hash table 'Example' and prints the first matched data. |
||
| 52 | //echo -ag result: $hfind(Example, *, 1, w).data |
||
| 53 | </pre> |