diff options
| author | Jeff Carr <[email protected]> | 2024-03-02 17:18:50 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-03-02 17:18:50 -0600 |
| commit | eebdaaf35763df8a159170c05a87eaaa37207484 (patch) | |
| tree | 93b49fa7850805d631746f3f73e84d7baeee82aa /common.go | |
| parent | de662f3b181fe85d97d4b3b249ebd1c09576c736 (diff) | |
trim non-numeric for debian packages
Diffstat (limited to 'common.go')
| -rw-r--r-- | common.go | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -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 +} |
