func (v GitHub) VersionFormatter(version string) (string, error) {
	const maxByte = 1<<8 - 1
	vo := make([]byte, 0, len(version)+8)
	j := -1
	for i := 0; i < len(version); i++ {
		b := version[i]
		if '0' > b || b > '9' {
			vo = append(vo, b)
			j = -1
			continue
		}
		if j == -1 {
			vo = append(vo, 0x00)
			j = len(vo) - 1
		}
		if vo[j] == 1 && vo[j+1] == '0' {
			vo[j+1] = b
			continue
		}
		if vo[j]+1 > maxByte {
			return "", fmt.Errorf("VersionOrdinal: invalid version")
		}
		vo = append(vo, b)
		vo[j]++
	}
	// Regex to remove all (non numeric OR period).
	reg := regexp.MustCompile("[^0-9.]")
	processedString := reg.ReplaceAllString(string(vo), "")

	return processedString, nil
}
// VersionFormatter takes a string version number and returns just the numeric parts.
// This function is used when trying to compare two string versions that 'could'
// have non numerical properties.
VersionFormatter takes a string version number and returns just the numeric parts.
This function is used when trying to compare two string versions that 'could'
have non numerical properties.
// VersionFormatter takes a string version number and returns just the numeric parts . // This function is used when trying to compare two string versions that ' could ' // have non numerical properties .
func (v GitHub) VersionFormatter(version string) (string, error) {
	const maxByte = 1<<8 - 1
	vo := make([]byte, 0, len(version)+8)
	j := -1
	for i := 0; i < len(version); i++ {
		b := version[i]
		if '0' > b || b > '9' {
			vo = append(vo, b)
			j = -1
			continue
		}
		if j == -1 {
			vo = append(vo, 0x00)
			j = len(vo) - 1
		}
		if vo[j] == 1 && vo[j+1] == '0' {
			vo[j+1] = b
			continue
		}
		if vo[j]+1 > maxByte {
			return "", fmt.Errorf("VersionOrdinal: invalid version")
		}
		vo = append(vo, b)
		vo[j]++
	}
	reg := regexp.MustCompile("[^0-9.]")
	processedString := reg.ReplaceAllString(string(vo), "")
	return processedString, nil
}
func ( v GitHub ) VersionFormatter ( version string ) ( string , error ) { const maxByte = 1 << 8 - 1 vo := make ( [ ] byte , 0 , len ( version ) + 8 ) j := - 1 for i := 0 ; i < len ( version ) ; i ++ { b := version [ i ] if '0' > b || b > '9' { vo = append ( vo , b ) j = - 1 continue } if j == - 1 { vo = append ( vo , 0x00 ) j = len ( vo ) - 1 } if vo [ j ] == 1 && vo [ j + 1 ] == '0' { vo [ j + 1 ] = b continue } if vo [ j ] + 1 > maxByte { return " " , fmt . Errorf ( " " ) } vo = append ( vo , b ) vo [ j ] ++ } reg := regexp . MustCompile ( " " ) processedString := reg . ReplaceAllString ( string ( vo ) , " " ) return processedString , nil }
VersionFormatter takes a string version number and returns just the numeric parts.
VersionFormatter takes a string version number and returns just the numeric parts .
// Regex to remove all (non numeric OR period).