Convert Int data type to Int16 Int32 Int64
Example
package main
import (
"fmt"
"reflect"
)
func main() {
var i int = 10
fmt.Println(reflect.TypeOf(i))
i16 := int16(i)
fmt.Println(reflect.TypeOf(i16))
i32 := int32(i)
fmt.Println(reflect.TypeOf(i32))
i64 := int64(i)
fmt.Println(reflect.TypeOf(i64))
}
Output
int
int16
int32
int64
Most Helpful This Week
Regular expression to validate the date format in "dd/mm/yyyy"
Find out how many logical processors used by current process
Example: Split, Join, and Equal from BYTES Package
Example of Fscan, Fscanf, and Fscanln from FMT Package
How to iterate over an Array using for loop?
Different ways to validate JSON string