mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2024-11-22 13:29:21 +00:00
Improve code readability
This commit is contained in:
parent
22f9670560
commit
70d5b50f4c
@ -19,8 +19,8 @@ use regex::Regex;
|
|||||||
/// assert_eq!(res1, "<b>hello world</b>");
|
/// assert_eq!(res1, "<b>hello world</b>");
|
||||||
/// ```
|
/// ```
|
||||||
pub fn remove_html_nodes(input: &str) -> String {
|
pub fn remove_html_nodes(input: &str) -> String {
|
||||||
input.replace("<", "<")
|
input.replace('<', "<")
|
||||||
.replace(">", ">")
|
.replace('>', ">")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check out whether a URL is valid or not
|
/// Check out whether a URL is valid or not
|
||||||
@ -64,14 +64,14 @@ pub fn check_string_before_insert(s: &str) -> bool {
|
|||||||
/// ```
|
/// ```
|
||||||
pub fn check_youtube_id(id: &str) -> bool {
|
pub fn check_youtube_id(id: &str) -> bool {
|
||||||
id.len() >= 5
|
id.len() >= 5
|
||||||
&& !id.contains("/")
|
&& !id.contains('/')
|
||||||
&& !id.contains("\\")
|
&& !id.contains('\\')
|
||||||
&& !id.contains("@")
|
&& !id.contains('@')
|
||||||
&& !id.contains("&")
|
&& !id.contains('&')
|
||||||
&& !id.contains("?")
|
&& !id.contains('?')
|
||||||
&& !id.contains(".")
|
&& !id.contains('.')
|
||||||
&& !id.contains("'")
|
&& !id.contains('\'')
|
||||||
&& !id.contains("\"")
|
&& !id.contains('\"')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user