mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-23 06:50:25 +08:00
用户端实现UDP设置/优化检查端口是否已被使用API
This commit is contained in:
21
internal/utils/strings.go
Normal file
21
internal/utils/strings.go
Normal file
@@ -0,0 +1,21 @@
|
||||
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||
|
||||
package utils
|
||||
|
||||
import "strings"
|
||||
|
||||
// SplitStrings 分隔字符串
|
||||
// 忽略其中为空的片段
|
||||
func SplitStrings(s string, glue string) []string {
|
||||
var result = []string{}
|
||||
|
||||
if len(s) > 0 {
|
||||
for _, p := range strings.Split(s, glue) {
|
||||
p = strings.TrimSpace(p)
|
||||
if len(p) > 0 {
|
||||
result = append(result, p)
|
||||
}
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user