Logo

Programming-Idioms

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

Idiom #153 Concatenate string with integer

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

String t = "%s%s".formatted(s, i);
String t = s + i;

The operator + works fine.
t : String := s & Integer'Image (i);

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