23 lines
417 B
Go
23 lines
417 B
Go
package tools
|
|
|
|
import (
|
|
"log"
|
|
"net/url"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestUrlEncode(t *testing.T) {
|
|
str := "aabb,&8?%s"
|
|
ret := url.QueryEscape(str)
|
|
log.Println(ret)
|
|
|
|
encodedValue := "Hell%C3%B6+W%C3%B6rld%40Golang"
|
|
decodedValue, err := url.QueryUnescape(encodedValue)
|
|
log.Println(decodedValue, err)
|
|
}
|
|
func TestContains(t *testing.T) {
|
|
b := strings.Contains("blog.baidu.com", "*.baidu.com")
|
|
log.Println(b)
|
|
}
|