mIRC Home    About    Download    Register    News    Help

Print Thread
$count #146304 02/04/06 07:17 PM
Joined: Apr 2006
Posts: 1
T
tracy Offline OP
Mostly harmless
OP Offline
Mostly harmless
T
Joined: Apr 2006
Posts: 1
$count is incorrectly returning the number of substrings in certain cases.

however, i feel that this will be a philosophical argument rather than a bugfix

$count(eee,ee) returns 1, but there are infact 2 instances of "ee" in there (1-2) and (2-3)

i cant imagine why u would exclude the letters you've already checked. this has to be a bug that seemed at first like it would speed up $count checks

does "ee" really appear only 5 times in "eeeeeeeeee" ??

Re: $count #146305 02/04/06 08:11 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Quote:
does "ee" really appear only 5 times in "eeeeeeeeee" ??
I would say no, and here's my reasoning:
Initial string "eeeeeeeeee"
First occurance of ee would be the first two e's (ie;$left(string,2))
Second occurance would be the 2nd & 3rd letters, since I don't see anything that says that the second e from the first occurance shouldn't be allowed as the first e in the second occurance.
etc.....
Therefore, in my opinion, I agree that this could be considered to be a bug.

Re: $count #146306 02/04/06 09:31 PM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
This could be a 'bug' or a 'feature' that could be overcome with a new identifier $countx(text,search) (similar to $replace vs $replacex). Or maybe a .prop for the $count identifier. $count(text,search).incl to include all occurances and $count(text,search).excl to exclude occurances that are within other occurances.

-genius_at_work