19 lines
393 B
Go
19 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, ")")
|
||
|
}
|