1
0
Fork 0
mirror of https://github.com/Luzifer/sii.git synced 2024-12-20 16:11:17 +00:00

Add method to clean license plates

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2019-12-24 18:46:03 +01:00
parent 8b75fde904
commit 0f837658e0
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -1,5 +1,10 @@
package sii
import (
"regexp"
"strings"
)
func init() {
RegisterBlock(&Trailer{})
}
@ -30,3 +35,13 @@ func (t *Trailer) Init(class, name string) {
}
func (t Trailer) Name() string { return t.blockName }
func (t Trailer) CleanedLicensePlate() string {
return regexp.MustCompile(` +`).ReplaceAllString(
regexp.MustCompile(`<[^>]+>`).ReplaceAllString(
strings.Split(t.LicensePlate, "|")[0],
" ",
),
" ",
)
}