func parseVerParts(v string) (int, int, int) {
	var num int
	for num = 0; num < len(v); num++ {
		if v[num] < '0' || v[num] > '9' {
			break
		}
	}
	if num == len(v) {
		return num, num, num
	}
	skip := strings.IndexFunc(v, func(b rune) bool {
		return b >= '!' && b <= '~' &&
			!(b > '/' && b < ':' ||
				b > '@' && b < '[' ||
				b > '`' && b < '{')
	})
	if skip == -1 {
		return num, len(v), len(v)
	}
	return num, skip, skip + 1
}
parseVerParts returns the length of consecutive run of digits in the beginning of the string,
the last non-separator chararcted (which should be compared), and index at which the version part (major, minor etc.) ends,
i.e. the position of the dot or end of the line.
E.g. parseVerParts("11b.4.16-New_Year_Edition") will return (2, 3, 4)
package nvd
import (
	"strings"
)
func smartVerCmp(v1, v2 string) int {
	for s1, s2 := v1, v2; len(s1) > 0 && len(s2) > 0; {
		num1, cmpTo1, skip1 := parseVerParts(s1)
		num2, cmpTo2, skip2 := parseVerParts(s2)
		ns1 := s1[:cmpTo1]
		ns2 := s2[:cmpTo2]
		diff := num1 - num2
		switch {
		case diff > 0:  
			ns2 = lpad(ns2, diff)
		case diff < 0:  
			ns1 = lpad(ns1, -diff)
		}
		if cmp := strings.Compare(ns1, ns2); cmp != 0 {
			return cmp
		}
		s1 = s1[skip1:]
		s2 = s2[skip2:]
	}
	if len(v1) > len(v2) {
		return 1
	}
	if len(v2) > len(v1) {
		return -1
	}
	return 0
}