gpu(darwin): format the string & fix behaviors on intel (#60)

* gpu(darwin): format the string

* gpu(darwin): fix behaviors on intel

* return string directly
This commit is contained in:
UUBulb
2024-09-06 08:31:19 +08:00
committed by GitHub
parent 439be0ddf3
commit 20316996f4
3 changed files with 96 additions and 52 deletions
+24
View File
@@ -4,6 +4,7 @@ import (
"fmt"
"net/http"
"os"
"strings"
"time"
jsoniter "github.com/json-iterator/go"
@@ -40,3 +41,26 @@ func BrowserHeaders() *http.Header {
"User-Agent": {MacOSChromeUA},
}
}
func ContainsStr(slice []string, str string) bool {
if str != "" {
for _, item := range slice {
if strings.Contains(str, item) {
return true
}
}
}
return false
}
func RemoveDuplicate[T comparable](sliceList []T) []T {
allKeys := make(map[T]bool)
list := []T{}
for _, item := range sliceList {
if _, value := allKeys[item]; !value {
allKeys[item] = true
list = append(list, item)
}
}
return list
}