52 lines
2.0 KiB
Rust
52 lines
2.0 KiB
Rust
pub fn contains_without_unter(classifier_name: &str, instance_name: &str) -> bool {
|
|
instance_name
|
|
.to_lowercase()
|
|
.contains(&classifier_name.to_lowercase())
|
|
&& !instance_name.to_lowercase().contains("unter")
|
|
}
|
|
|
|
pub fn contains(classifier_name: &str, instance_name: &str) -> bool {
|
|
instance_name
|
|
.to_lowercase()
|
|
.contains(&classifier_name.to_lowercase())
|
|
}
|
|
|
|
pub fn contains_case_sensitive(classifier_name: &str, instance_name: &str) -> bool {
|
|
instance_name.contains(classifier_name)
|
|
}
|
|
|
|
pub fn starts_with_roman_number(_: &str, s: &str) -> bool {
|
|
// Define the prefixes for Roman numerals.
|
|
let roman_prefixes = [
|
|
"I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII", "XIII", "XIV",
|
|
"XV", "XVI", "XVII", "XVIII", "XIX", "XX",
|
|
];
|
|
|
|
// Check if the string starts with one of the Roman numeral prefixes followed by a period.
|
|
roman_prefixes
|
|
.iter()
|
|
.any(|&prefix| s.starts_with(&(prefix.to_string() + ".")))
|
|
}
|
|
|
|
pub fn contains_at_start(_classifier_name: &str, instance_name: &str) -> bool {
|
|
!instance_name.is_empty() && instance_name.starts_with('@')
|
|
}
|
|
|
|
pub fn starts_with_number(_classifier_name: &str, instance_name: &str) -> bool {
|
|
matches!(instance_name.trim().as_bytes().first(), Some(c) if c.is_ascii_digit())
|
|
}
|
|
|
|
pub fn starts_with_letter(_classifier_name: &str, instance_name: &str) -> bool {
|
|
instance_name.starts_with(|c: char| c.is_ascii_lowercase())
|
|
&& (instance_name.chars().nth(1) == Some('.') || instance_name.chars().nth(1) == Some(')'))
|
|
}
|
|
|
|
pub fn starts_with_uppercaseletter(_classifier_name: &str, instance_name: &str) -> bool {
|
|
instance_name.starts_with(|c: char| c.is_ascii_uppercase())
|
|
&& (instance_name.chars().nth(1) == Some('.') || instance_name.chars().nth(1) == Some(')'))
|
|
}
|
|
|
|
pub fn starts_with_dash(_classifier_name: &str, instance_name: &str) -> bool {
|
|
instance_name.starts_with('-') && (instance_name.chars().nth(1) == Some(' '))
|
|
}
|