XinYeYouKu/app/third/dfpOpenSdk/util/sdk_util.go

38 lines
554 B
Go
Raw Normal View History

2024-07-08 18:01:02 +08:00
package util
import (
"net/url"
"strings"
)
func CheckReqUri(reqUri string) string {
if reqUri == "" {
return reqUri
}
if !strings.HasPrefix(reqUri, "/") {
reqUri = "/" + reqUri
}
if strings.HasSuffix(reqUri, "/") {
reqUri = reqUri[:len(reqUri)-1]
}
return reqUri
}
func JointMap(paramsMap map[string]string) string {
values := url.Values{}
for k, v := range paramsMap {
values.Add(k, v)
}
encodeString := values.Encode()
return encodeString
}
func EmptyString(str string) bool {
return len(strings.TrimSpace(str)) == 0
}