Logo

Programming-Idioms

  • Java
  • Ruby
  • Php
$s = "$i";
$s = (string)$i;
$s = "{$i}";
$s = strval($i);
String s=((Integer)i).toString();
String s = "";
while (i != 0) {
    s = i % 10 + s;
    i = i / 10;
}
String s = "%d".formatted(i);
String s = String.valueOf(i);

This is a static method.
String s = Integer.toString(i);

This is a static method, no need to create an Integer instance.
String s = "" + i;
s = i.to_s
S : String := Integer'Image (I);

New implementation...