pub fn is_list_word(word: &str) -> bool {
  debug_assert!(!word.chars().any(|c| c.is_whitespace()));

  if word == "*" || word == "-" || word == "+" {
    true
  } else {
    let mut had_number = false;
    let mut had_end_char = false;
    for c in word.chars() {
      if had_end_char {
        return false;
      }

      if !had_number {
        if c.is_numeric() {
          had_number = true;
        } else {
          return false;
        }
      } else {
        if !c.is_numeric() {
          if c == '.' || c == ')' {
            had_end_char = true;
          } else {
            return false;
          }
        }
      }
    }

    had_end_char
  }
}
/// Checks if the provided word is a word that could be a list.
/// Assumes the provided string is one word and doesn't have whitespace.
Checks if the provided word is a word that could be a list.
Assumes the provided string is one word and doesn't have whitespace.
Checks if the provided word is a word that could be a list . Assumes the provided string is one word and doesn ' t have whitespace .
pub fn is_list_word(word: &str) -> bool {
  debug_assert!(!word.chars().any(|c| c.is_whitespace()));
  if word == "*" || word == "-" || word == "+" {
    true
  } else {
    let mut had_number = false;
    let mut had_end_char = false;
    for c in word.chars() {
      if had_end_char {
        return false;
      }
      if !had_number {
        if c.is_numeric() {
          had_number = true;
        } else {
          return false;
        }
      } else {
        if !c.is_numeric() {
          if c == '.' || c == ')' {
            had_end_char = true;
          } else {
            return false;
          }
        }
      }
    }
    had_end_char
  }
}
pub fn is_list_word ( word : & str ) -> bool { debug_assert ! ( word chars ( ) any ( c c is_whitespace ( ) ) ) ; if word == " " || word == " " || word == " " { true } else { let mut had_number = false ; let mut had_end_char = false ; for c in word . chars ( ) { if had_end_char { return false ; } if ! had_number { if c . is_numeric ( ) { had_number = true ; } else { return false ; } } else { if ! c . is_numeric ( ) { if c == '.' || c == ')' { had_end_char = true ; } else { return false ; } } } } had_end_char } }
Checks if the provided word is a word that could be a list.
Checks if the provided word is a word that could be a list .
word
&str
word
&str