Archive: strloc in reverse


strloc in reverse
the StrLoc macro in StrFunc can search backwards, but how can it find the last occurence?

I'm trying to find the last backslash on this path
c:\profiles\nikos

${StrLoc} $0 $PROFILE "\" "<"
$0 == 14!! (first backslash)

thanks


actually, StrLoc can't search backwards... the > vs < is just the direction counter. You'll want to use StrStrAdv or so...


${StrStrAdv} $0 $1 "\" "<" "<" 0 0 1
StrLen $0 $0


Or write your own function.. would be smaller :)
( might be something up in the wiki already anyway )

Or write your own function.. would be smaller
that's what i did, copied parts of GetParent :)

Or there's all types of word find functions includes as part of the WordFunc.nsh header.

See Appendix E of the NSIS help.