NSIS 去除字串中的汉字

!include "LogicLib.nsh"
XPStyle on
!include "WordFunc.nsh"
#编写,水晶石
#去除字串中的汉字
#本例仅是个思路,测试环境和给出的条件有限,如有异常,有进一步修改的余地。
OutFile "NSIStest.exe"
Name "test"
Section "test"
StrCpy $0 "测试x电影y下载2欢迎你5来了" ;测试用字串
StrLen $1 $0
StrCpy $2 ''
ReadRegStr $R2 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" "CurrentVersion"
${Select} $R2
  ${Case4}
"4.9" "5.0" "5.1" "5.2"
         
${Do}
            
IntOp $1 $1 - 1
             
${IfThen} $1 = -1 ${|}${ExitDo}${|}
               
StrCpy $3 $0 1 $1
             ${if} $3
!= ''
         
StrCpy $2 '$3$2'
    
${endif}
${Loop}
MessageBox MB_OK '$2'
        
${Case2} "6.0" "6.1"
        
#摘取字串中的数字和字母,实际运用中含有符号或其他特别字符自行修改StrFilter的参数
             
${StrFilter} "$0" "12" "" "" $R0
        
MessageBox MB_OK '$R0'
${EndSelect}
SectionEnd

posted on 2022-08-12 19:30  水晶石  阅读(70)  评论(0编辑  收藏  举报