1234567891011121314151617181920212223242526272829303132333435363738394041 |
- package com
- import (
- "encoding/base64"
- "net/url"
- )
- func UrlEncode(str string) string {
- return url.QueryEscape(str)
- }
- func UrlDecode(str string) (string, error) {
- return url.QueryUnescape(str)
- }
- func Base64Encode(str string) string {
- return base64.StdEncoding.EncodeToString([]byte(str))
- }
- func Base64Decode(str string) (string, error) {
- s, e := base64.StdEncoding.DecodeString(str)
- return string(s), e
- }
|