Conversion de Types en Go

Comment convertir les types en Go


int64 🠮 string

FormatInt

1
strconv.FormatInt(i int64, base int)

Itoa

1
2
strconv.Itoa(i int)
// Itoa is equivalent to FormatInt(int64(i), 10). 

string 🠮 int64

ParseInt

1
strconv.ParseInt(s string, base int, bitSize int)

Atoi

1
2
strconv.Atoi(s string)
// Atoi is equivalent to ParseInt(s, 10, 0), converted to type int. 

string 🠮 Time

Parse

1
time.Parse(layout, value string)

ParseInLocation

1
time.ParseInLocation(layout, value string, loc *Location)

Time 🠮 string

Pour le layout.

Time.Format

1
2
var t time.Time
t.Format(layout string)
Licensed under CC BY-NC-SA 4.0
Généré avec Hugo
Thème Stack conçu par Jimmy