pub fn natural_cmp(a: &str, b: &str) -> OrderingExpand description
Compare two bean IDs using natural ordering. Parses IDs as dot-separated segments and compares them. Numeric segments are compared numerically, alpha segments lexicographically. Numeric segments sort before alpha segments.
§Examples
- “1” < “2” (numeric comparison)
- “1” < “10” (numeric comparison, not string comparison)
- “3.1” < “3.2” (multi-level comparison)
- “abc” < “def” (alpha comparison)
- “1” < “abc” (numeric sorts before alpha)