Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
MonkeyIsMe committed Oct 3, 2022
2 parents 04aabb4 + 0c383ac commit 0d584ce
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions constant/constant.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ const (

MethodPost = "POST"
MethodGet = "GET"

RetryTimes = 3
)

type Weekday int
Expand Down
11 changes: 11 additions & 0 deletions strings/string.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"encoding/base64"
"encoding/hex"
"fmt"
"github.com/shootz-developer/gtool/constant"
"math"
"math/big"
"math/rand"
Expand Down Expand Up @@ -177,3 +178,13 @@ func Similarity(s1 string, s2 string) float64 {
sim := strsim.Compare(s1, s2)
return sim
}

// StringFilter 字符串过滤,将1,2,3,4,5 -> '1','2','3','4','5'
func StringFilter(ids string) string {
splitString := strings.Split(ids, constant.Comma)
videos := fmt.Sprintf("'%s'", splitString[0])
for i := 1; i < len(splitString); i++ {
videos = fmt.Sprintf("%s,'%s'", videos, splitString[i])
}
return videos
}

0 comments on commit 0d584ce

Please sign in to comment.