golang的各种数据格式的互相转换
2015-12-23 12:47
411 查看
int to string
import ( "strconv" ) int i = 10 str1 := strconv.Itoa(i)
struct to json
import ( "encoding/json" ) type Server struct { ServerName string ServerIP string } b, err := json.Marshal(s) if err != nil { fmt.Println("json err:", err) } fmt.Println(string(b))
未完待续
相关文章推荐
- golang 的编译安装以及supervisord部署
- Intent中的四个属性 action category data extras
- poj 2007 Scrambled Polygon 【极角排序】
- 如何更改WORDPRESS后台登录页面LOGO
- Google 搜索
- 论文笔记:going deeper with convolutions
- SSHException: Incompatible ssh peer (no acceptable kex algorithm)
- Google Map通过经纬度获取详细地址
- lanczos bidiagonalization(1)
- Good Bye2015,Hello 2016
- 类别(Categories)和扩展/匿名类别(extensions)及其延伸使用
- django中使用日志输出
- Django学习小结
- Go语言学习
- The 2015 China Collegiate Programming Contest G. Ancient Go hdu 5546
- 获取xml中backgound属性的statelistdrawable里drawable的方法
- Mongo 常用命令
- Go语言的管道Channel用法实例
- 银行家算法(Banker's Algorithm)
- Good Luck Charlie(听力恢复训练)