NSIS 连接两个字符串的一部分
我正在尝试在 NSIS 中将两个字符串合并在一起。我有两根弦 2.1.3.0 和 0.0.0.27269 我想从它们创建的字符串是 2.1.3.27269
到目前为止我的尝试还没有成功,这是我尝试过的:
;;$VERSION is defined with 2.1.3.0
;;$FILEVERSION2 is defined with 0.0.0.27269
;;debug
DetailPrint ${VERSION}
DetailPrint ${FILEVERSION}
;;attempt, also it doesn't say what the variables $R0-$R2 are after values
;;copied into them, is that normal?
StrCpy $R0 ${FILEVERSION2} 5 -5
StrCpy $R1 ${VERSION} -2
StrCpy $R2 $R1"."$R0
DetailPrint $R2 ;;this doesn't print a value, only prints "$R2"
!define FILEVERSION3 $R2
任何帮助都会很棒。 亨特
还在这里发帖:http://forums.winamp.com/showthread.php? p=2777308#post2777308
I am trying to sort of merge two strings together in NSIS. I have two strings
2.1.3.0 and 0.0.0.27269 and the string I want to create from them is 2.1.3.27269
My attempts thus far haven't worked, here is what I tried:
;;$VERSION is defined with 2.1.3.0
;;$FILEVERSION2 is defined with 0.0.0.27269
;;debug
DetailPrint ${VERSION}
DetailPrint ${FILEVERSION}
;;attempt, also it doesn't say what the variables $R0-$R2 are after values
;;copied into them, is that normal?
StrCpy $R0 ${FILEVERSION2} 5 -5
StrCpy $R1 ${VERSION} -2
StrCpy $R2 $R1"."$R0
DetailPrint $R2 ;;this doesn't print a value, only prints "$R2"
!define FILEVERSION3 $R2
Any help would be great.
Hunter
also posted here: http://forums.winamp.com/showthread.php?p=2777308#post2777308
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要在 NSIS 中连接变量,您需要将它们用引号引起来。
查看 NSIS 字符串函数列表 也可能会有所帮助。某些函数(例如获取字符串的第一部分和最后部分的函数)可以使您的代码比使用硬编码索引分割字符串更健壮。
To concatenate variables in NSIS you need to wrap them in quote marks.
It also might pay to have a look through the NSIS string functions list. Some of the functions such as the ones to get the first and last parts of strings could make your code more robust than splitting strings using hardcoded indexes.