opening-hours-syntax 2.1.1

A parser for opening_hours fields in OpenStreetMap.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
pub(crate) fn is_capitalized(s: &str) -> bool {
    let mut chars = s.chars();

    let Some(first_char) = chars.next() else {
        return true;
    };

    (first_char.is_uppercase() || !first_char.is_alphanumeric())
        && chars.all(|c| c.is_lowercase() || !c.is_alphanumeric())
}

pub(crate) fn is_lowercase(s: &str) -> bool {
    s.chars().all(|c| c.is_lowercase() || !c.is_alphanumeric())
}