How do I concatenate 2 strings in NSIS
Asked Answered
A

4

46

How do I concatenate 2 strings in NSIS?

Arita answered 13/4, 2010 at 20:9 Comment(0)
R
42
StrCpy $1 "one string"

StrCpy $2 " second string"

MessageBox MB_OK "$1$2"
Reconstructionist answered 13/4, 2010 at 20:14 Comment(0)
H
21

If you want to concatenate using the same variable you can do something like this:

StrCpy $1 "ABC"

StrCpy $1 "$1123"

DetailPrint $1

output is "ABC123"

Highball answered 27/9, 2011 at 20:30 Comment(1)
+1 for mentioning that the variables can be placed just next to string literalsBohaty
A
15
StrCpy $1 "Hello"

StrCpy $2 "World"

StrCpy $3 "$1 $2"

DetailPrint $3
Adventurer answered 4/5, 2010 at 17:54 Comment(0)
O
0

If you're looking to split up one long string over multiple lines, just use the \ inside the quotes:

MessageBox MB_OK "Alright, Mr. User you are done here, so you can go ahead and \ 
stop reading this message box about now."
Overcautious answered 29/12, 2018 at 18:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.