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

Idiom #55 Convert integer to string

Create the string representation s (in radix 10) of integer value i.

Illustration
1
var s = "$i";
S : String := Integer'Image (I);
#include <stdlib.h>
char s[0x1000]={};
itoa(i,s,10);
(let [s (str i)])
#include <string>
auto s = std::to_string(i);
string s = i.ToString()
import std.conv;
string s = to!string(i);
s = Integer.to_string(i)
S = integer_to_list(I).
import "fmt"
s := fmt.Sprintf("%d", i)
import "strconv"
s := strconv.FormatInt(i, 10)
import "strconv"
s := strconv.Itoa(i)
s = show i
var s = i.toString();
String s = String.valueOf(i);
String s = Integer.toString(i);
String s=((Integer)i).toString();
s = tostring(i)
$s="$i"
SysUtils
var
  _s: String;
  _i: Integer;
begin
  _s := IntToStr(_i);
end.
$s = "" . $i;
s = str(i)
s = i.to_s
let s = format!("{}", i);
val s = i.toString
(define s (number->string i))

Do you know the best way to do this in your language ?
New implementation...

Idiom created by

programming-idioms.org

Related idioms