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:
parent
8b75fde904
commit
0f837658e0
1 changed files with 15 additions and 0 deletions
|
@ -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],
|
||||
" ",
|
||||
),
|
||||
" ",
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue