Skip to main content

natural_cmp

Function natural_cmp 

Source
pub fn natural_cmp(a: &str, b: &str) -> Ordering
Expand description

Orders ids the way they count: runs of digits compare as numbers, so A_1.2 precedes A_1.10 and C_6.99 precedes C_6.100, and everything else compares as text, ignoring case. Ids that still tie (01 vs 1, a vs A) fall back to plain text order so the ordering stays total.