Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Go ParseInt()中使用的基本参数是什么?_Go - Fatal编程技术网

Go ParseInt()中使用的基本参数是什么?

Go ParseInt()中使用的基本参数是什么?,go,Go,每当我们尝试将字符串转换为int时,我都会遇到许多示例代码: parseValue, err := strconv.ParseInt(value, 10, 64) 因此,上面的代码有三个参数。从文档代码: func ParseInt(s string, base int, bitSize int) (i int64, err error) { 我试图理解这里的base int,因此我将值从0更改为16 当输入为0和10时,结果正常。其他编号0和10为紧急状态。我仍然困惑不解,不明白。有人能解

每当我们尝试将字符串转换为int时,我都会遇到许多示例代码:

parseValue, err := strconv.ParseInt(value, 10, 64)
因此,上面的代码有三个参数。从文档代码:

func ParseInt(s string, base int, bitSize int) (i int64, err error) {
我试图理解这里的
base int
,因此我将值从0更改为16


当输入为
0
10
时,结果正常。其他编号
0
10
为紧急状态。我仍然困惑不解,不明白。有人能解释一下
base
ParseInt()
中用于什么吗?

您正在将字符串转换为整数。该方法要求您输入字符串所在的基数(数字系统)。您可以在此处了解有关数字系统的更多信息:

例如(使用提供的代码段):

结果:

Hello, 15 with type int64!

我真的问了一个愚蠢的问题,但谢谢你的回答。这对我有帮助。
Hello, 15 with type int64!