natural

package
v0.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package natural implements natural-order string comparison. It sits below the public packages (github.com/gechr/x/strings, github.com/gechr/x/set, github.com/gechr/x/slices) so they can share it without import cycles.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(a, b string) int

Compare orders `a` and `b` the way a human reads them, treating each run of digits as a single decimal number so `x2` sorts before `x10`. It returns -1, 0, or +1 and allocates nothing, handling numbers of any length without overflow.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL