Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to concatenate number to string in macro?

Tags:

inno-setup

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?

like image 907
user1810087 Avatar asked Mar 17 '15 15:03

user1810087


People also ask

How do I concatenate a string and a number in VBA?

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.

How do I concatenate a number to a string?

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.

How do you concatenate numbers in VBA?

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.

How do you concatenate in a macro?

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.


1 Answers

You can use the Str function to typecast your integer variable:

#define MyString "Text"
#define MyInteger 666
#define MyVariable MyString + Str(MyInteger)
like image 157
TLama Avatar answered Sep 29 '22 20:09

TLama