17 lines
547 B
Markdown
17 lines
547 B
Markdown
|
# src.lwithers.me.uk/go/versionsort
|
||
|
|
||
|
[![GoDoc](https://godoc.org/src.lwithers.me.uk/go/versionsort?status.svg)](https://godoc.org/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]
|
||
|
```
|