Melora Hugues
54794b57a4
All checks were successful
continuous-integration/drone/push Build is passing
18 lines
393 B
Go
18 lines
393 B
Go
package devicepath
|
|
|
|
import "strings"
|
|
|
|
func getPrefix(raw string) string {
|
|
firstCharAfterId := strings.Index(raw, "(")
|
|
if firstCharAfterId == -1 {
|
|
return ""
|
|
}
|
|
return raw[0:firstCharAfterId]
|
|
}
|
|
|
|
func checkStringFormat(raw, prefix string, length int) bool {
|
|
if length > 0 && len(raw) != length {
|
|
return false
|
|
}
|
|
return strings.HasPrefix(raw, prefix+"(") && strings.HasSuffix(raw, ")")
|
|
}
|