///|
pub fn normalize_code(input : String) -> String {
let had_presentation_space = input.contains(" ") || input.contains("\t")
let compact = input
.trim()
.to_owned()
.to_upper()
.replace_all(old=" ", new="")
.replace_all(old="\t", new="")
if had_presentation_space &&
compact.length() == 4 &&
compact.get_char(0) is Some(first) &&
is_ascii_letter(first) &&
compact.get_char(3) is Some(last) &&
is_digit_char(last) {
compact[:3].to_owned() + "." + compact[3:].to_owned()
} else {
compact
}
}
///|
pub fn is_valid_category(code : String) -> Bool {
let normalized = normalize_code(code)
normalized.length() == 3 &&
normalized.get_char(0) is Some(first) &&
is_ascii_letter(first) &&
parse_two_digits(normalized, at=1) is Some(_)
}