mIRC Homepage
Posted By: tracy $count - 02/04/06 07:17 PM
$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" ??
Posted By: RusselB Re: $count - 02/04/06 08:11 PM
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.
Posted By: genius_at_work Re: $count - 02/04/06 09:31 PM
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
© mIRC Discussion Forums