Talk:StrRep
From NSIS Wiki
Jump to navigationJump to search
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. To get mine to work, I added the last StrCmp but i'm not sure if that's the right solution.
${StrReplace} $1 "example" "" "This is just an example" found: StrCpy $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_3 IntOp $STR_REPLACE_VAR_8 $STR_REPLACE_VAR_3 + $STR_REPLACE_VAR_4 StrCpy $STR_REPLACE_VAR_7 $STR_REPLACE_VAR_0 "" $STR_REPLACE_VAR_8 StrCpy $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_5$STR_REPLACE_VAR_2$STR_REPLACE_VAR_7 StrLen $STR_REPLACE_VAR_6 $STR_REPLACE_VAR_0 ; added to prevent infinite loop StrCmp $STR_REPLACE_VAR_3 $STR_REPLACE_VAR_6 done Goto loop ([[User:kenglish_hi|kenglish_hi]])