pub fn sort_names_as_dotted_number_sequences_numerically_first_3_fields_lexicographically_afterwards(name1:&str,name2:&str,n_already_done:usize) -> Ordering {
        if name1==name2 { Ordering::Equal }
        else if name1.is_empty() { Ordering::Less } // should never happen
        else if name2.is_empty() { Ordering::Greater } // should never happen
        else {
            let (name1_prefix,name1_suffix) = name1.split_once('.').unwrap_or((name1,""));
            let (name2_prefix,name2_suffix) = name2.split_once('.').unwrap_or((name2,""));
            if name1_prefix==name2_prefix { Self::sort_names_as_dotted_number_sequences_numerically_first_3_fields_lexicographically_afterwards(name1_suffix,name2_suffix,n_already_done+1)}
            else if n_already_done<3 {
                name1_prefix.parse::<usize>().unwrap().cmp(&name2_prefix.parse::<usize>().unwrap())
            } else {
                name1_prefix.cmp(name2_prefix)
            }
        }
    }
/// Compare two strings for ordering. The two strings should be in the form of integers separated by `.` characters.
/// For the first 3-n_already_done, compare integers numerically. Afterwards sort lexicographically.
/// # Examples
/// ```
/// use std::cmp::Ordering;
/// use nsw::NSWECLocalGov2021;
/// assert_eq!(Ordering::Equal,NSWECLocalGov2021::sort_names_as_dotted_number_sequences_numerically_first_3_fields_lexicographically_afterwards("3.5.6.7","3.5.6.7",0));
/// assert_eq!(Ordering::Less,NSWECLocalGov2021::sort_names_as_dotted_number_sequences_numerically_first_3_fields_lexicographically_afterwards("3.5.6.7","3.5.26.7",0));
/// assert_eq!(Ordering::Greater,NSWECLocalGov2021::sort_names_as_dotted_number_sequences_numerically_first_3_fields_lexicographically_afterwards("3.5.6.7","3.5.6.27",0));
/// ```
Compare two strings for ordering. The two strings should be in the form of integers separated by `.` characters.
For the first 3-n_already_done, compare integers numerically. Afterwards sort lexicographically.
Compare two strings for ordering . The two strings should be in the form of integers separated by ` . ` characters . For the first 3 - n_already_done compare integers numerically . Afterwards sort lexicographically .
pub fn sort_names_as_dotted_number_sequences_numerically_first_3_fields_lexicographically_afterwards(name1:&str,name2:&str,n_already_done:usize) -> Ordering {
        if name1==name2 { Ordering::Equal }
        else if name1.is_empty() { Ordering::Less } // should never happen
        else if name2.is_empty() { Ordering::Greater } // should never happen
        else {
            let (name1_prefix,name1_suffix) = name1.split_once('.').unwrap_or((name1,""));
            let (name2_prefix,name2_suffix) = name2.split_once('.').unwrap_or((name2,""));
            if name1_prefix==name2_prefix { Self::sort_names_as_dotted_number_sequences_numerically_first_3_fields_lexicographically_afterwards(name1_suffix,name2_suffix,n_already_done+1)}
            else if n_already_done<3 {
                name1_prefix.parse::<usize>().unwrap().cmp(&name2_prefix.parse::<usize>().unwrap())
            } else {
                name1_prefix.cmp(name2_prefix)
            }
        }
    }
pub fn sort_names_as_dotted_number_sequences_numerically_first_3_fields_lexicographically_afterwards ( name1 : & str , name2 : & str , n_already_done : usize ) -> Ordering { if name1 == name2 { Ordering :: Equal } else if name1 . is_empty ( ) { Ordering :: Less } // should never happen else if name2 . is_empty ( ) { Ordering :: Greater } // should never happen else { let ( name1_prefix , name1_suffix ) = name1 . split_once ( '.' ) . unwrap_or ( ( name1 , " " ) ) ; let ( name2_prefix , name2_suffix ) = name2 . split_once ( '.' ) . unwrap_or ( ( name2 , " " ) ) ; if name1_prefix == name2_prefix { Self :: sort_names_as_dotted_number_sequences_numerically_first_3_fields_lexicographically_afterwards ( name1_suffix , name2_suffix , n_already_done + 1 ) } else if n_already_done < 3 { name1_prefix . parse :: < usize > ( ) . unwrap ( ) . cmp ( & name2_prefix . parse :: < usize > ( ) . unwrap ( ) ) } else { name1_prefix . cmp ( name2_prefix ) } } }
Compare two strings for ordering.
Compare two strings for ordering .
name1
&str
name2
&str
n_already_done
usize
name1
&str
name2
&str
n_already_done
usize
examples
```
use std::cmp::Ordering;
use nsw::NSWECLocalGov2021;
assert_eq!(Ordering::Equal,NSWECLocalGov2021::sort_names_as_dotted_number_sequences_numerically_first_3_fields_lexicographically_afterwards("3.5.6.7","3.5.6.7",0));
assert_eq!(Ordering::Less,NSWECLocalGov2021::sort_names_as_dotted_number_sequences_numerically_first_3_fields_lexicographically_afterwards("3.5.6.7","3.5.26.7",0));
assert_eq!(Ordering::Greater,NSWECLocalGov2021::sort_names_as_dotted_number_sequences_numerically_first_3_fields_lexicographically_afterwards("3.5.6.7","3.5.6.27",0));
```
` ` ` use std :: cmp :: Ordering ; use nsw :: NSWECLocalGov2021 ; assert_eq! ( Ordering :: Equal NSWECLocalGov2021 :: sort_names_as_dotted_number_sequences_numerically_first_3_fields_lexicographically_afterwards ( " 3 . 5 . 6 . 7 " " 3 . 5 . 6 . 7 " 0 )) ; assert_eq! ( Ordering :: Less NSWECLocalGov2021 :: sort_names_as_dotted_number_sequences_numerically_first_3_fields_lexicographically_afterwards ( " 3 . 5 . 6 . 7 " " 3 . 5 . 26 . 7 " 0 )) ; assert_eq! ( Ordering :: Greater NSWECLocalGov2021 :: sort_names_as_dotted_number_sequences_numerically_first_3_fields_lexicographically_afterwards ( " 3 . 5 . 6 . 7 " " 3 . 5 . 6 . 27 " 0 )) ; ` ` `