Registry / utility / xlab-handysort

xlab-handysort

JSON →
library0.0.0-20150421192137-fb3537ed64a1gogounverified

Package handysort implements alphanumeric string comparison for natural sorting order.

go get github.com/xlab/handysort
INSTALL
IMPORT
SIG · XLAB-HANDYSORT
X
xlab-handysort
utilitygov0.0.0-20150421192137-fb3537ed64a1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

handysort
github.com/xlab/handysort

Sort strings alphanumerically using handysort.Less.

package main import ( "fmt" "sort" "github.com/xlab/handysort" ) func main() { strs := []string{"a2", "a10", "a1"} sort.Slice(strs, func(i, j int) bool { return handysort.Less(strs[i], strs[j]) }) fmt.Println(strs) }
Debug
Known issues
gotchahandysort is 5x-8x slower than simple string comparison.
fix
Use only when natural sorting is required; for simple lexicographic sort, use standard sort.
affects: >=0.0.0
Upgrade
Version history
0.0.0-20150421192137-fb3537ed64a1latest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
8
Amazon
1
Resources
xlab-handysort — go get xlab-handysort · libregistry