I want to concatinate a version number to a string in inno-setup preprocessor macros. I tried to use the stringer trick (used in c++ macros) like this:
#define stringer_helper(arg) #arg
#define stringer(arg) stringer_helper(arg)
#define version 1
#define myapp "lala " + stringer(version)
but get the error:
Illegal character in input file: '#' (0x23)
How is it possible to append a number define to a string define?
Method 1: By using the ampersand (&) operator. Method 2: By using the addition (+) operator. 2. We use ampersand and addition operator to concatenate strings in VBA.
If you want to concatenate a string and a number, such as an integer int or a floating point float , convert the number to a string with str() and then use the + operator or += operator.
VBA Concatenate. To concatenate two strings using a VBA code, you need to use the ampersand. You can use an ampersand in between two strings to combine them and then assign that new value to a cell, variable, or message box. In the same way, you can concatenate more than two values as well.
Click the top cell in the right column of data that you want to concatenate. For example, if cells A1:A100 and B1:B100 contain data, click cell B1. On the Tools menu, point to Macros, and then click Macro. Select the ConcatColumns macro, and then click Run.
You can use the Str
function to typecast your integer variable:
#define MyString "Text"
#define MyInteger 666
#define MyVariable MyString + Str(MyInteger)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With