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