Logo

Programming-Idioms

  • Java
  • Ruby
String s = Integer.toString(i);

This is a static method, no need to create an Integer instance.
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 = "" + i;
s = i.to_s
S : String := Integer'Image (I);

New implementation...