diff --git a/string.go b/string.go index f05d0f7..94cddb1 100644 --- a/string.go +++ b/string.go @@ -133,3 +133,16 @@ func (s *stringOperate) RemoveDuplicates(sourceList []string) []string { } return result } + +// Map2Query map参数转换为url query +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 20:51 2022/10/10 +func (s *stringOperate) Map2Query(data map[string]string) string { + list := make([]string, 0) + for k, v := range data { + list = append(list, k+"="+v) + } + return strings.Join(list, "&") +}