Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!

Idiom #153 Concatenate string with integer

Create the string t as the concatenation of the string s and the integer i.

#include <string>
auto t = s + std::to_string (i);
t : String := s & Integer'Image (i);
(def t (str s i))
var t = $"{s} {i}";
import std.conv : to;
string t = s ~ to!string(i);
import std.format : format;
string t = "%s%d".format(s, i);
var t = '$s$i';
t =  s <>  to_string(i)
write (unit=t,fmt='(A,I0)') s, i
import "strconv"
t := s + strconv.Itoa(i)
import "fmt"
t := fmt.Sprintf("%s%d", s, i)
t = s ++ show i
let t = `${s}${i}`
let t = s + i;
String t = String.format("%s%d", s, i);
String t = s + i;
(format nil "~a~d" s i)
t = s .. i
$t = $s . $i;
uses SysUtils;
t := s + IntToStr(i);
uses Sysutils;
t := s + i.ToString;
my $t = "$s$i";
my $t = $s . $i;
t = f"{s}{i}"
t = "#{s}#{i}"
t = s + i.to_s
let t = format!("{}{}", s, i);
let t = format!("{s}{i}");
val t = s + i
t := s, i asString.

New implementation...
< >
programming-idioms.org