linstrom/ap/util.go
2024-08-28 17:20:38 +02:00

19 lines
389 B
Go

package ap
import "strings"
type InvalidFullHandleError struct {
Raw string
}
func (i InvalidFullHandleError) Error() string {
return "Invalid full handle"
}
func SplitFullHandle(full string) (string, string, error) {
splits := strings.Split(strings.TrimPrefix(full, "@"), "@")
if len(splits) != 2 {
return "", "", InvalidFullHandleError{}
}
return splits[0], splits[1], nil
}