docs/vendor/github.com/skarademir/naturalsort
David Gageot 89675067eb Clean-up dependencies
Signed-off-by: David Gageot <david@gageot.net>
2015-11-12 19:56:58 +01:00
..
LICENSE.md Move to vendor 2015-11-03 21:14:39 -08:00
README.md Move to vendor 2015-11-03 21:14:39 -08:00
naturalsort.go Move to vendor 2015-11-03 21:14:39 -08:00

README.md

naturalsort

A simple natural sorter for Go Strings ##Usage Implements the sort.Interface

called by sort.Sort(NaturalSort([]string) ###Example SampleStringArray := []string{"z24", "z2", "z15", "z1", "z3", "z20", "z5", "z11", "z 21", "z22"} sort.Sort(NaturalSort(SampleStringArray)) ##Needless Description Inspired by Jeff Atwood's seminal blog post and structured similarly to Ian Griffiths' C# implementation. This uses a regex to split the numeric and non-numeric portions of the string into a chunky array. Next, the left and right sides' chunks are compared either by string comparrison (if either is a non-numeric chunk), or by integer (if both chunks are numeric)