mIRC Home    About    Download    Register    News    Help

Print Thread
#220703 22/04/10 02:53 AM
Joined: Feb 2003
Posts: 106
L
Vogon poet
OP Offline
Vogon poet
L
Joined: Feb 2003
Posts: 106
I have a large hash table saved as altnicks.dat. The table associates nicks with addresses and vice versa so I can monitor users as they change nicks.
Assume the following
Code:
/hmake hash 10
/hload hash altnicks.dat

Now, I want to find out how many nicks contain the string "grass", so I use
Code:
/echo -a $hfind(hash,*grass*,0,w)
and the number 22 is returned. Fine so far.

If I then load altnicks.dat into notepad++, and do a word count for "grass", I get 44 as the number of occurrences.
Furthermore, the command
Code:
/echo -a $hfind(hash,*summer*,0,w
returns zero, whereas notepad++ shows that there are 53 occurrences of "summer".

Am I using $hfind correctly, and/or what is a better approach to count the number of specific strings in a hash table?

Thanks.


-
Just because it never happened doesn't mean it isn't true.
lerpicus #220705 22/04/10 03:03 AM
Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
in a hashtable it's set up like: tablename->itemname->data

$hfind() returns matches for itemnames only
$hfind().data returns matches for data only

I think when you are searching with nopepad++ it's looking at all occurances
for ex:

[hasttablename]
summer!someident@host.com=summer winter fall spring

notepad++ would see the item and data where as $hfind either looks at the data or the itemname


I am SReject
My Stuff
Joined: Feb 2003
Posts: 106
L
Vogon poet
OP Offline
Vogon poet
L
Joined: Feb 2003
Posts: 106
doh! $hfind().data !!
Brain was too tired to read the help file correctly.

Thanks Froggie


-
Just because it never happened doesn't mean it isn't true.
lerpicus #220716 22/04/10 04:17 AM
Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
You're welcome


I am SReject
My Stuff

Link Copied to Clipboard