码迷,mamicode.com
首页 > Web开发 > 详细

WebSafeBase64Decode

时间:2017-06-30 00:04:40      阅读:349      评论:0      收藏:0      [点我收藏+]

标签:span   pad   des   web   bsp   style   lan   dap   pre   

 

WebSafeBase64Decode  golang  (adapter zplay doubleclick )
func base64url_decode(s string) ([]byte, error) {
    base64Str := strings.Map(func(r rune) rune {
        switch r {
        case -:
            return +
        case _:
            return /
        }

        return r
    }, s)

    if pad := len(base64Str) % 4; pad > 0 {
        base64Str += strings.Repeat("=", 4-pad)
    }

    return base64.StdEncoding.DecodeString(base64Str)
}

 

WebSafeBase64Decode

标签:span   pad   des   web   bsp   style   lan   dap   pre   

原文地址:http://www.cnblogs.com/lavin/p/7096445.html

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