ExistOnlyOne 检查字符串数组中是否只有一个非空元素
(strs []string)
| 15 | |
| 16 | // ExistOnlyOne 检查字符串数组中是否只有一个非空元素 |
| 17 | func 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 验证域名格式是否正确 |
| 28 | func ValidateDomainName(domain string) bool { |
nothing calls this directly
no outgoing calls
no test coverage detected