Logo

Programming-Idioms

  • Kotlin
  • C++
  • Python
  • Rust
  • PHP
  • Scala
  • C
  • Pascal
  • Go
  • Dart
var s = "$i";
val s = i.toString()
#include <string>
auto s = std::to_string(i);
s = str(i)
let s = format!("{}", i);

s has type String
let s = i.to_string();

s has type String
$s = "{$i}";
$s = "$i";
$s = strval($i);
$s = (string)$i;
val s = i.toString
#include <stdlib.h>
char s[0x1000]={};
itoa(i,s,10);
uses SysUtils;
var
  _s: String;
  _i: Integer;
begin
  _s := IntToStr(_i);
end.
Str(i,s);

No dependecies on any library.
Should work in all Pascal dialects.
import "strconv"
s := strconv.FormatInt(i, 10)

When i has type int64.
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.
S : String := Integer'Image (I);

New implementation...