Logo

Programming-Idioms

  • Dart
  • Java
  • Java
  • Go
  • Lua
s = tostring(i)
var s = "$i";
String s = "";
while (i != 0) {
    s = i % 10 + s;
    i = i / 10;
}
String s = Integer.toString(i);

This is a static method, no need to create an Integer instance.
String s = "%d".formatted(i);
String s = String.valueOf(i);

This is a static method.
String s=((Integer)i).toString();
String s = "" + i;
import "fmt"
s := fmt.Sprintf("%d", i)

This works with all types of integers.

Sprintf does type assertions, and is slower than the strconv flavors
import "strconv"
s := strconv.Itoa(i)

When i has type int.
import "strconv"
s := strconv.FormatInt(i, 10)

When i has type int64.
S : String := Integer'Image (I);

New implementation...