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

Idiom #153 Concatenate string with integer

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

t = s + i.to_s
import std.conv : to;
string t = s ~ to!string(i);
1
import std.format : format;
string t = "%s%d".format(s, i);
import "fmt"
t := fmt.Sprintf("%s%d", s, i)
String t = s + i;
SysUtils
begin
  t := s + IntToStr(i);
end.
t = '{}{}'.format(s,i)
let t = format!("{}{}", s, i);

Do you know the best way to do this in your language ?
New implementation...

Idiom created by

programming-idioms.org

Related idioms