diff --git a/Cargo.toml b/Cargo.toml index 258f751..226a772 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "schmfy" -version = "0.1.0" +version = "0.1.1" edition = "2021" license = "MIT OR Apache-2.0" description = "Schmfication library" diff --git a/src/lib.rs b/src/lib.rs index 17620d3..4ce5b0e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,6 +4,15 @@ pub fn schmfy(source: String) -> String { return source; } + if source.len() == 0 { + return source; + } + + // can't be empty + if !source.chars().next().unwrap().is_alphabetic() { + return source; + } + // if source is subsite (e.g. news/fsr), schmfy all parts separately if source.contains('/') { return source