增加map数组转换为url query方法

This commit is contained in:
白茶清欢 2022-10-10 20:52:06 +08:00
parent e95f609c0f
commit 1c9c8be53c

View File

@ -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, "&")
}