devicepath/utils.go
Melora Hugues 54794b57a4
All checks were successful
continuous-integration/drone/push Build is passing
add beginning of parser
2023-08-27 15:09:30 +02:00

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, ")")
}