Refined docs and stuff
Docs link to each other and are generally better
This commit is contained in:
@@ -4,6 +4,29 @@ use yew::prelude::*;
|
||||
use yew_router::prelude::*;
|
||||
|
||||
#[macro_export]
|
||||
/// Removes surrounding double quotes from a string.
|
||||
///
|
||||
/// This macro takes an expression that evaluates to a string and returns a new `String`
|
||||
/// with any leading or trailing double quotes removed. It's useful for cleaning up
|
||||
/// string data that might be inadvertently wrapped in quotes, such as JSON string values.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `$str`: An expression that can be converted into a string slice (`&str`).
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```rust
|
||||
/// use your_crate::dequote; // Assuming `dequote` is re-exported or in scope
|
||||
///
|
||||
/// let quoted_string = "\"hello world\"";
|
||||
/// let dequoted_string = dequote!(quoted_string);
|
||||
/// assert_eq!(dequoted_string, "hello world");
|
||||
///
|
||||
/// let already_clean = "no quotes";
|
||||
/// let dequoted_clean = dequote!(already_clean);
|
||||
/// assert_eq!(dequoted_clean, "no quotes");
|
||||
/// ```
|
||||
macro_rules! dequote {
|
||||
($str:expr) => {
|
||||
$str.trim_matches('"').to_string()
|
||||
|
||||
Reference in New Issue
Block a user