MCPcopy Create free account
hub / github.com/MengMengCode/GetRealityDomain / ExistOnlyOne

Function ExistOnlyOne

utils.go:17–25  ·  view source on GitHub ↗

ExistOnlyOne 检查字符串数组中是否只有一个非空元素

(strs []string)

Source from the content-addressed store, hash-verified

15
16// ExistOnlyOne 检查字符串数组中是否只有一个非空元素
17func ExistOnlyOne(strs []string) bool {
18 count := 0
19 for _, s := range strs {
20 if s != "" {
21 count++
22 }
23 }
24 return count == 1
25}
26
27// ValidateDomainName 验证域名格式是否正确
28func ValidateDomainName(domain string) bool {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected