Registry / utility / maruel-natural

maruel-natural

JSON →
library1.3.0gogounverified

Package natural defines a natural 'less' function to compare strings while interpreting natural numbers, with no memory allocation.

go get github.com/maruel/natural
INSTALL
IMPORT
SIG · MARUEL-NATURAL
M
maruel-natural
utilitygov1.3.0
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.

natural
github.com/maruel/natural

Sort strings using natural ordering.

package main import ( "fmt" "sort" "github.com/maruel/natural" ) func main() { items := []string{"file2", "file10", "file1"} sort.Slice(items, func(i, j int) bool { return natural.Less(items[i], items[j]) }) fmt.Println(items) }
Debug
Known issues

No known issues recorded.

Upgrade
Version history
1.3.0latest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
maruel-natural — go get maruel-natural · libregistry