字符串 "jdbc:postgresql://localhost:5432/DatabaseName"
我的需求是从上面的字符串中仅获取数据库名。
我尝试了以下链接,但它并没有起作用。
${Explode} $0 "jdbc:postgresql://localhost:5432/" "$v1"
出现了无效命令错误。
http://nsis.sourceforge.net/Explode
在NSIS语言中如何解决此问题,由于我对NSIS语言不太熟悉,请帮忙解决。提前感谢。
字符串 "jdbc:postgresql://localhost:5432/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
StrCpy
会执行此操作。 - Anders