1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-12-25 13:08:50 +00:00

Improve code readability

This commit is contained in:
Pierre HUBERT 2022-03-17 18:26:09 +01:00
parent 22f9670560
commit 70d5b50f4c

View File

@ -19,8 +19,8 @@ use regex::Regex;
/// assert_eq!(res1, "<b>hello world</b>");
/// ```
pub fn remove_html_nodes(input: &str) -> String {
input.replace("<", "&lt;")
.replace(">", "&gt;")
input.replace('<', "&lt;")
.replace('>', "&gt;")
}
/// 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 {
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('\"')
}