Use text.contains instead of text.find
This commit is contained in:
parent
9eb433c815
commit
05cc8ed95b
|
@ -330,7 +330,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "mangafetchi"
|
||||
version = "0.1.3"
|
||||
version = "0.1.4"
|
||||
dependencies = [
|
||||
"quick-xml",
|
||||
"reqwest",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "mangafetchi"
|
||||
version = "0.1.3"
|
||||
version = "0.1.4"
|
||||
authors = ["blank X <theblankx@protonmail.com>"]
|
||||
edition = "2018"
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ fn generate_slug(text: &str) -> String {
|
|||
.replace(&['ỳ', 'ý', 'ỵ', 'ỷ', 'ỹ'][..], "y")
|
||||
.replace('đ', "d")
|
||||
.replace(&['!', '@', '%', '^', '*', '(', ')', '+', '=', '<', '>', '?', '/', ',', '.', ':', ';', '\'', ' ', '"', '&', '#', '[', ']', '~', '-'][..], "_");
|
||||
while text.find("__").is_some() {
|
||||
while text.contains("__") {
|
||||
text = text.replace("__", "_");
|
||||
}
|
||||
text.trim_matches('_').to_string()
|
||||
|
|
Loading…
Reference in New Issue