Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Concatenation of string and int value in nim

Tags:

nim-lang

I want to concatenate string and int. But it doesn't work with & and add operator.

echo "abc" & 2

But it doesn't work.

like image 785
frogEye Avatar asked Jan 29 '18 10:01

frogEye


People also ask

Can you concatenate a string and an integer?

To concatenate a string to an int value, use the concatenation operator. Here is our int. int val = 3; Now, to concatenate a string, you need to declare a string and use the + operator.

Can we concatenate string and integer in CPP?

To concatenate string and integer data, we have to convert integer to string at first. To convert it we are using stringstream.

How do I concatenate strings and variables in SQL?

Concatenation using += operator. The following example concatenates using the += operator. DECLARE @v1 VARCHAR(40); SET @v1 = 'This is the original. '; SET @v1 += ' More text.


1 Answers

There's an operator $ that converts something to string.

echo "abc" & $2
echo "abc", 2 # echo automatically applies `$` to its arguments
like image 190
uran Avatar answered Sep 30 '22 09:09

uran