diff --git a/z/helpers.go b/z/helpers.go index 755aeba..b235bc9 100644 --- a/z/helpers.go +++ b/z/helpers.go @@ -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