簡體   English   中英

如何使用charStrip nsis

[英]how to use charStrip nsis

我不確定我是否了解如何使用charStrip,因此我在下面創建了腳本,並且在$ current_compare上未顯示任何內容,請幫助

我試圖調用此函數,但無法正常工作。

Exch $R0 #char <br/>
Exch <br/>
Exch $R1 #in string <br/>
Push $R2 <br/>
Push $R3 <br/>
Push $R4 <br/>
 StrCpy $R2 -1 <br/>
 IntOp $R2 $R2 + 1 <br/>
 StrCpy $R3 $R1 1 $R2 <br/>
 StrCmp $R3 "" +8 <br/>
 StrCmp $R3 $R0 0 -3 <br/>
  StrCpy $R3 $R1 $R2 <br/>
  IntOp $R2 $R2 + 1 <br/>
  StrCpy $R4 $R1 "" $R2 <br/>
  StrCpy $R1 $R3$R4 <br/>
  IntOp $R2 $R2 - 2 <br/>
  Goto -9 <br/>
  StrCpy $R0 $R1 <br/>
Pop $R4 <br/>
Pop $R3 <br/>
Pop $R2 <br/>
Pop $R1 <br/>
Exch $R0 <br/>
FunctionEnd <br/>

OutFile test.exe <br/>

Var /GLOBAL CURRENT_COMPARE <br/>
Section 1 <br/>
  !macro CharStrip Char InStr OutVar <br/>
  Push '.' <br/>
  Push 'v8.11.3' <br/>
  Call CharStrip <br/>
 Pop '$CURRENT_COMPARE' <br/>
!macroend <br/>
MessageBox MB_OK $CURRENT_COMPARE <br/>
 SectionEnd <br/>

我假設您從Wiki修改了此代碼

在您的示例中,您沒有插入宏,因此從未調用CharStrip函數。 您不應該修改宏,只需將正確的參數傳遞給它即可:

Function CharStrip
Exch $R0 #char
Exch
Exch $R1 #in string
Push $R2
Push $R3
Push $R4
 StrCpy $R2 -1
 IntOp $R2 $R2 + 1
 StrCpy $R3 $R1 1 $R2
 StrCmp $R3 "" +8
 StrCmp $R3 $R0 0 -3
  StrCpy $R3 $R1 $R2
  IntOp $R2 $R2 + 1
  StrCpy $R4 $R1 "" $R2
  StrCpy $R1 $R3$R4
  IntOp $R2 $R2 - 2
  Goto -9
  StrCpy $R0 $R1
Pop $R4
Pop $R3
Pop $R2
Pop $R1
Exch $R0
FunctionEnd
!macro CharStrip Char InStr OutVar
 Push '${InStr}'
 Push '${Char}'
  Call CharStrip
 Pop '${OutVar}'
!macroend
!define CharStrip '!insertmacro CharStrip'

Var /GLOBAL CURRENT_COMPARE

Section 1
${CharStrip} '.' 'v8.11.3' $CURRENT_COMPARE
MessageBox mb_OK $CURRENT_COMPARE
SectionEnd

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM