We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
package main
import ( "encoding/base64" "fmt" "log" )
func main() { input := []byte("hello golang base64 快乐编程http://www.01happy.com +~")
// 演示base64编码 encodeString := base64.StdEncoding.EncodeToString(input) fmt.Println(encodeString) // 对上面的编码结果进行base64解码 decodeBytes, err := base64.StdEncoding.DecodeString(encodeString) if err != nil { log.Fatalln(err) } fmt.Println(string(decodeBytes)) fmt.Println() // 如果要用在url中,需要使用URLEncoding uEnc := base64.URLEncoding.EncodeToString([]byte(input)) fmt.Println(uEnc) uDec, err := base64.URLEncoding.DecodeString(uEnc) if err != nil { log.Fatalln(err) } fmt.Println(string(uDec))
}
The text was updated successfully, but these errors were encountered:
No branches or pull requests
package main
import (
"encoding/base64"
"fmt"
"log"
)
func main() {
input := []byte("hello golang base64 快乐编程http://www.01happy.com +~")
}
The text was updated successfully, but these errors were encountered: