chore: improve trimming string from bytes

This commit is contained in:
andig 2023-08-08 10:32:43 +02:00
parent b86ef91ec2
commit ddffab0599

View file

@ -44,7 +44,7 @@ const (
// ChargeStatusString converts a string to ChargeStatus
func ChargeStatusString(s string) (ChargeStatus, error) {
status := strings.ToUpper(s)
status := strings.ToUpper(strings.TrimSpace(strings.Trim(s, "\x00")))
switch s1 := status[:1]; s1 {
case "A", "B":
return ChargeStatus(s1), nil