|
|
#1 |
|
Major Dude
Join Date: Jan 2005
Location: Oregon Coast
Posts: 737
|
WordFind bug
This is a function included with NSIS, but I'm not sure whether this would be considered a problem in NSIS or just the external function, so I'll report it here.
To Kichik: If you feel this should be reported as a bug in NSIS, let me know. Details Here's the example code: code: The answer for the first WordFind call returns 2, when it should only be 1. But, the function works fine when you are dealing with paths (from the 2nd WordFind call above) |
|
|
|
|
|
#2 |
|
Major Dude
Join Date: Jul 2004
Posts: 665
|
code: |
|
|
|
|
|
#3 |
|
Major Dude
Join Date: Jan 2005
Location: Oregon Coast
Posts: 737
|
OK, I see the problem:
The docs say "*" is supposed to return the number of delimiters, while "#" is supposed to return the sum of the words. I can see that your example works and now understand why: It's because the "*" counts delimiters and it seems that delimiters can never be the first in the list. So, your example works for the "three", but if I change to look for "one", then it returns the "1" for both. I still think there's a bug here. If "#" works like is documented, then it should return the same number regardless of whether the item to be searched in in the beginning or middle of the string. |
|
|
|
|
|
#4 |
|
Major Dude
Join Date: Jul 2004
Posts: 665
|
Where is no bug. What you are trying to do?
|
|
|
|
|
|
#5 |
|
Major Dude
Join Date: Jan 2005
Location: Oregon Coast
Posts: 737
|
I'm trying to count how many times a word appears in a delimited list.
also: To make it clear, your suggestion does work, but doesn't appear to follow the documentation for reasons outlined in my last post. |
|
|
|
|
|
#6 |
|
Major Dude
Join Date: Jan 2005
Location: Oregon Coast
Posts: 737
|
Nevermind...
I was playing around some more and finally see why: In my example, "three" is considered a delimiter. So between the delimiter, there are actually 2 "words": "one|two|" and "|four" But only one "delimiter": "three" I guess it just didn't make sense to me following the examples. But after I read closer the actual description, it finally started to make sense. Thanks, Instructor. |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|