Lowercase only first char when normalizing
This commit is contained in:
parent
3a75089e5a
commit
a9435e4f64
1 changed files with 9 additions and 1 deletions
|
|
@ -1,3 +1,11 @@
|
||||||
pub fn normalize_link(link: &str) -> String {
|
pub fn normalize_link(link: &str) -> String {
|
||||||
link.trim().to_lowercase().replace(' ', "_")
|
let link = link.trim().replace(' ', "_");
|
||||||
|
|
||||||
|
// Make only first char lowercase
|
||||||
|
link.chars()
|
||||||
|
.next()
|
||||||
|
.iter()
|
||||||
|
.flat_map(|c| c.to_lowercase())
|
||||||
|
.chain(link.chars().skip(1))
|
||||||
|
.collect::<String>()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue