From 1c9c8be53c8208d1a48a013f574f400b05a0f827 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Mon, 10 Oct 2022 20:52:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0map=E6=95=B0=E7=BB=84?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2=E4=B8=BAurl=20query=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- string.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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, "&") +}