Talk:StrRep: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
No edit summary
(Bug when replacing string at the end of a line)
Line 15: Line 15:


::-[[User:Dandaman32|dandaman32]] 10:36, 8 July 2006 (PDT)
::-[[User:Dandaman32|dandaman32]] 10:36, 8 July 2006 (PDT)
== Bug when replacing string at the end of a line ==
When I try to replace a string at the end of the file, it gets stuck in an infinite loop.
${StrReplace} $1 "example" "" "This is just an example"

Revision as of 01:25, 26 October 2007

Hello, there is a bug when i replace '\' by '\\' like : c:\test\myfile.exe AFTER STRREPLACE c:\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\.... instead of c:\\test\\myfile.exe

You should ask Dandaman32 to fix it. In the mean while, you can use the old version which works perfectly fine. --kichik 03:17, 19 May 2006 (PDT)
This is a known bug, and I'm not totally sure how to fix it. The bug is triggered when your replacement string contains the entire search string, i.e. ${StrReplace} $VAR "\" "\\" $VAR. I'm still trying to fix this, in the meantime, try this:
${StrReplace} $VAR "\" "--{FOO BAR}--" $VAR
${StrReplace} $VAR "--{FOO BAR}--" "\\" $VAR
--{FOO BAR}-- is just a temporary replacement for "\". It could be any text you like, just make sure it's something that won't already be in the string, like "/" or ":".
-dandaman32 10:36, 8 July 2006 (PDT)

Bug when replacing string at the end of a line

When I try to replace a string at the end of the file, it gets stuck in an infinite loop.

${StrReplace} $1 "example" "" "This is just an example"