go 数据类型转换

graph TD A[整型
int, int8, int16, int32, int64] -->|类型转换| B[浮点型
float32, float64] B -->|类型转换| A A -->|类型转换| C[布尔型
bool] C -->|类型转换| A B -->|类型转换| D[复数型
complex64, complex128] D -->|类型转换| B A -->|strconv.Itoa| E[字符串
string] E -->|strconv.Atoi
strconv.ParseInt| A B -->|strconv.FormatFloat| E E -->|strconv.ParseFloat| B C -->|strconv.FormatBool| E E -->|strconv.ParseBool| C A -->|类型转换| F[字节型
byte, rune] F -->|类型转换| A E -->|UTF-8 编码
strings.Bytes| F F -->|UTF-8 解码
string| E G[其他类型
slice, array, map, struct, pointer] -->|接口或类型断言| H[通过接口或类型断言] H -->|接口或类型断言| G A -->|类型转换| G B -->|类型转换| G C -->|类型转换| G D -->|类型转换| G E -->|类型转换| G F -->|类型转换| G subgraph strconv包 A -->|strconv.Atoi
strconv.ParseInt| E E -->|strconv.Itoa
strconv.FormatInt| A B -->|strconv.FormatFloat| E E -->|strconv.ParseFloat| B C -->|strconv.FormatBool| E E -->|strconv.ParseBool| C end subgraph 字符串与字节型 E -->|strings.Bytes| F F -->|string| E end style A fill:#f9f,stroke:#333,stroke-width:2px style B fill:#ccf,stroke:#333,stroke-width:2px style C fill:#cfc,stroke:#333,stroke-width:2px style D fill:#ccf,stroke:#333,stroke-width:2px style E fill:#fcf,stroke:#333,stroke-width:2px style F fill:#f9f,stroke:#333,stroke-width:2px style G fill:#f9f,stroke:#333,stroke-width:2px style H fill:#f9f,stroke:#333,stroke-width:2px end
相关推荐
kkeeper~1 天前
0基础C语言积跬步之深入理解指针(5下)
c语言·开发语言
一直不明飞行1 天前
Java的equals(),hashCode()应该在什么时候重写
java·开发语言·jvm
盲敲代码的阿豪1 天前
Python 入门基础教程(爬虫前置版)
开发语言·爬虫·python
basketball6161 天前
C++ 构造函数完全指南:从入门到进阶
java·开发语言·c++
互联科技报1 天前
2026超融合选型:Top5品牌与市场格局解读
开发语言·perl
weixin199701080161 天前
[特殊字符] 智能数据采集:数字化转型的“数据石油勘探队”(附Python实战源码)
开发语言·python
想唱rap1 天前
IO多路转接之poll
服务器·开发语言·数据库·c++
@杰克成1 天前
Java学习30
java·开发语言·学习
三品吉他手会点灯1 天前
C语言学习笔记 - 40.数据类型 - scanf函数的编程规范与非法输入处理
c语言·开发语言·笔记·学习
凯瑟琳.奥古斯特1 天前
数据冗余与规范化的本质[数据库原理]
开发语言·数据库·职场和发展