1

5.5 Go语言中的类型转换

 2 years ago
source link: https://blog.csdn.net/xiaoquqi/article/details/125984084
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

类型转换关系

From b []byte i []int r []rune s string f float32/float64 i int
To
[]byte · []byte(s)
[]int · []int(s)
[]rune []rune(s)
string string(b) string(i) string® ·
float32 · float32(i)
int int(f) ·

示例:类型转换测试

package main

import</
文章知识点与官方知识档案匹配,可进一步学习相关知识

GO语言学习笔记

编译命令:go build xxx.go 运行命令:go run xxx.go 格式化命令:gofmt xxx.go 格式化重写入文件命令:gofmt -w xxx.go

第一章、GO程序开发注意事项

1、严格区分大小写 2、每个语句不需要加分号 3、一行只能写一条语句 4、定义变量或import包如果没有使用到,代码不能编译通过 5、大括号是成对出现,缺一不可

第二章、GO语言转义字符

1、\t:一个制表符,通常用于排版 2、\n :换行符 3、\ :一个\ 4、


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK