String “ jdbc:postgresql:// localhost:5432 / DatabaseName”
我的要求是从上述字符串中仅获取DatabaseName。
我尝试了下面的链接,但没有用。
${Explode} $0 "jdbc:postgresql://localhost:5432/" "$v1"
给出错误无效命令。
http://nsis.sourceforge.net/Explode
如何用NSIS语言实现。因为我不太熟悉NSIS语言。请做必要的帮助。预先感谢。
如果只需要获取最后一个/
之后的其余字符串,则可以使用一些基本的NSIS字符串处理:
Section
StrCpy $0 "jdbc:postgresql://localhost:5432/DatabaseName"
StrCpy $1 0
loop:
IntOp $1 $1 - 1 ; Character offset, from end of string
StrCpy $2 $0 1 $1 ; Read 1 character into $2, -$1 offset from end
StrCmp $2 '/' found
StrCmp $2 '' stop loop ; No more characters or try again
found:
IntOp $1 $1 + 1 ; Don't include / in extracted string
stop:
StrCpy $2 $0 "" $1 ; We know the length, extract final string part
DetailPrint "|$2|"
SectionEnd
WordFind函数让您做到这一点,看看它的示例
您应该尝试使用NSISpcre plugin,也许您需要一些讨厌的正则表达式:p