mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-06-20 08:25:16 +00:00
Remove HTML code of conversation names
This commit is contained in:
@ -5,4 +5,5 @@
|
||||
pub mod crypt_utils;
|
||||
pub mod user_data_utils;
|
||||
pub mod virtual_directories_utils;
|
||||
pub mod date_utils;
|
||||
pub mod date_utils;
|
||||
pub mod string_utils;
|
19
src/utils/string_utils.rs
Normal file
19
src/utils/string_utils.rs
Normal file
@ -0,0 +1,19 @@
|
||||
//! # String utilities
|
||||
//!
|
||||
//! This module contains utilities that can be used accross all the application
|
||||
|
||||
/// Escape an HTML string
|
||||
///
|
||||
/// Removes the HTML code included inside a string
|
||||
///
|
||||
/// ```
|
||||
/// use comunic_server::utils::string_utils::remove_html_nodes;
|
||||
///
|
||||
/// let s1 = "<b>hello world</b>";
|
||||
/// let res1 = remove_html_nodes(s1);
|
||||
/// assert_eq!(res1, "<b>hello world</b>");
|
||||
/// ```
|
||||
pub fn remove_html_nodes(input: &str) -> String {
|
||||
input.replace("<", "<")
|
||||
.replace(">", ">")
|
||||
}
|
Reference in New Issue
Block a user