$hfind » History » Version 7
Per Amundsen, 11/22/2015 02:48 PM
1 | 1 | Per Amundsen | _Added in 1.9.0_ |
---|---|---|---|
2 | |||
3 | *$hfind(name|N,text,[N],[M],[@window|command])* |
||
4 | |||
5 | Searches table for the Nth item name which matches text and returns the item name. |
||
6 | |||
7 | 7 | Per Amundsen | _See also [[$hmatch]]._ |
8 | |||
9 | 1 | Per Amundsen | *Parameters* |
10 | |||
11 | name|N - Name of the hash table or the Nth hash table. |
||
12 | text - Text to search for. |
||
13 | [N] - If N = 0, number of matches, otherwise the Nth match. (optional) |
||
14 | [M] - (optional) |
||
15 | <pre> |
||
16 | n - Normal text comparison. (default if M is not specified) |
||
17 | w - Text is wildcard text. |
||
18 | W - Hash table item/data is wildcard text. |
||
19 | 6 | Per Amundsen | r - Text is a egular expression. |
20 | R - Hash table item/data is a regular expression. |
||
21 | 1 | Per Amundsen | </pre> |
22 | |||
23 | 4 | Per Amundsen | [@window|command] - if @window is defined, fills the side-listbox with the results, otherwise the command is run on each result. |
24 | 1 | Per Amundsen | |
25 | *Properties* |
||
26 | |||
27 | .data - Search for a matching data value instead of item name. |
||
28 | |||
29 | *Example* |
||
30 | |||
31 | <pre> |
||
32 | ; 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. |
||
33 | //echo -ag result: $hfind(Example, *, 0, w, echo -ag $1-) |
||
34 | |||
35 | ; Searches the hash table 'Example' and prints the number of matches. |
||
36 | //echo -ag result: $hfind(Example, *, 0, w) |
||
37 | |||
38 | ; Searches the hash table 'Example' and prints the first matched item. |
||
39 | //echo -ag result: $hfind(Example, *, 1, w) |
||
40 | |||
41 | ; Searches the hash table 'Example' and prints the first matched data. |
||
42 | //echo -ag result: $hfind(Example, *, 1, w).data |
||
43 | </pre> |