diff --git a/common.go b/common.go index f482ac7..c2625f7 100644 --- a/common.go +++ b/common.go @@ -1,6 +1,8 @@ package repolist import ( + "unicode" + "go.wit.com/gui" "go.wit.com/lib/gui/repostatus" "go.wit.com/log" @@ -176,3 +178,21 @@ func (rl *RepoList) TotalGo() int { } return count } + +func trimNonNumericFromStart(s string) string { + for i, r := range s { + if unicode.IsDigit(r) { + return s[i:] + } + } + return "" +} + +func ValidDebianPackageVersion(v string) string { + newv := trimNonNumericFromStart(v) + if newv == "" { + newv = "0.0" + } + log.Info("ValidDebianPackageVersion:", newv) + return newv +} diff --git a/scan.go b/scan.go index 7200898..f4b0921 100644 --- a/scan.go +++ b/scan.go @@ -7,8 +7,8 @@ import ( "strconv" "strings" - "go.wit.com/log" "go.wit.com/lib/gui/repostatus" + "go.wit.com/log" ) func (r *RepoList) RegisterHideFunction(f func(*RepoRow)) {