|
|
#1 |
|
Junior Member
Join Date: Feb 2007
Posts: 19
|
WordFind can't count?
Hi,
I want to detect whether a substring is present in a string. I try to count how often a substring occurs in a string using WordFind... As long as the substring occurs at least once it works. But if the the substring is not present at all I don't get '0' as expected (and needed!) but I get the string I searched in as result. Any Ideas? Sample: ${WordFind} "C:\io.sys C:\logo.sys C:\WINDOWS" "sys" "*" $R0 detailprint "found 'sys' [$R0] times." // Ok, result = 2 ${WordFind} "C:\io.sys C:\logo.sys C:\WINDOWS" "xyz" "*" $R0 detailprint "found 'xyz' [$R0] times." This fails, $R0 contains "C:\io.sys C:\logo.sys C:\WINDOWS" xirisone |
|
|
|
|
|
#2 | |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
As the documentation says, if you don't use E in the options, you get the input string back in case of errors.
Quote:
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Feb 2007
Posts: 19
|
@kichik
I'll check that out. Still I have a problem of understanding... I'd say the result of '0' times found is a valid result and no error. The function should simply return '0'. The documentation even says the code I used is a sample for counting. xirisone |
|
|
|
|
|
#4 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
Where exactly does the documentation say that? I can't find it.
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#5 | |
|
Junior Member
Join Date: Feb 2007
Posts: 19
|
The documentation at 'E.3.2 WordFind' says:
Quote:
The problem itself is easy enough to solve, it's just for my understanding. TIA, xirisone |
|
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|