Implemented GetProjectIdFromName

This commit is contained in:
マリウス 2020-10-17 01:32:31 +01:00
parent b6eefeb0c8
commit a89d78f66c
No known key found for this signature in database
GPG key ID: C228EF0A530AF06F

View file

@ -4,6 +4,7 @@ import (
"os/user"
"regexp"
"strconv"
"strings"
"time"
"math"
"errors"
@ -101,6 +102,17 @@ func ParseTime(timeStr string) (time.Time, error) {
}
}
func GetProjectIdFromName(projectName string) string {
reg, regerr := regexp.Compile("[^a-zA-Z0-9]+")
if regerr != nil {
return ""
}
projectId := strings.ToLower(reg.ReplaceAllString(projectName, ""))
return projectId
}
func GetISOCalendarWeek(date time.Time) (int) {
var _, cw = date.ISOWeek()
return cw