码迷,mamicode.com
首页 > 其他好文 > 详细

golang的interface到其他类型的数据转换

时间:2014-06-26 17:29:36      阅读:202      评论:0      收藏:0      [点我收藏+]

标签:style   class   blog   code   color   数据   

以string为例

package main

import "fmt"

func main() {
    var a interface{}
    var b string
    a = "asdasdasdasd"
    b = a.(string)
    fmt.Println(a, b)
}

 

golang的interface到其他类型的数据转换,布布扣,bubuko.com

golang的interface到其他类型的数据转换

标签:style   class   blog   code   color   数据   

原文地址:http://www.cnblogs.com/ziyouchutuwenwu/p/3808646.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!