547 B
547 B
src.lwithers.me.uk/go/versionsort
This package provides a Go implementation of the venerable C function
versionsort(3)
. This lets you sort strings containing natural numbers, such
as versions. It understands that 1.12
is greater than 1.6
, for example.
Example of usage:
input := []string{"1.12", "1.24", "1.1", "1.6"}
versionsort.Strings(input)
fmt.Println(input)
// Output: [1.1 1.6 1.12 1.24]