cml04-gdm-int/internal/helpers/helper.go

27 lines
437 B
Go
Raw Normal View History

2024-08-20 10:09:47 +02:00
package helpers
import (
"regexp"
"time"
)
func CleanString(input string) string {
return regexp.MustCompile("[^a-zA-Z0-9]+").ReplaceAllString(input, "")
}
func HeaderTimeStamp(t time.Time) [8]int16 {
year := t.Year() % 100
timeStamp := [8]int16{
int16(20),
int16(year),
int16(t.Month()),
int16(t.Day()),
int16(t.Hour()),
int16(t.Minute()),
int16(t.Second()),
int16(t.Nanosecond() / 1e6),
}
return timeStamp
}