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
相关推荐
星火开发设计1 小时前
枚举类 enum class:强类型枚举的优势
linux·开发语言·c++·学习·算法·知识
喜欢吃燃面6 小时前
Linux:环境变量
linux·开发语言·学习
徐徐同学6 小时前
cpolar为IT-Tools 解锁公网访问,远程开发再也不卡壳
java·开发语言·分布式
LawrenceLan6 小时前
Flutter 零基础入门(二十六):StatefulWidget 与状态更新 setState
开发语言·前端·flutter·dart
m0_748229997 小时前
Laravel8.X核心功能全解析
开发语言·数据库·php
qq_192779877 小时前
C++模块化编程指南
开发语言·c++·算法
代码村新手7 小时前
C++-String
开发语言·c++
qq_401700418 小时前
Qt 中文乱码的根源:QString::fromLocal8Bit 和 fromUtf8 区别在哪?
开发语言·qt
EndingCoder9 小时前
案例研究:从 JavaScript 迁移到 TypeScript
开发语言·前端·javascript·性能优化·typescript