summaryrefslogtreecommitdiff
path: root/utils/string_proc/src/macros.rs
diff options
context:
space:
mode:
Diffstat (limited to 'utils/string_proc/src/macros.rs')
-rw-r--r--utils/string_proc/src/macros.rs64
1 files changed, 64 insertions, 0 deletions
diff --git a/utils/string_proc/src/macros.rs b/utils/string_proc/src/macros.rs
index 135268e..414baf0 100644
--- a/utils/string_proc/src/macros.rs
+++ b/utils/string_proc/src/macros.rs
@@ -1,3 +1,11 @@
+/// Convert to camelCase format (brewCoffee)
+///
+/// # Examples
+///
+/// ```
+/// # use string_proc::camel_case;
+/// assert_eq!(camel_case!("brew_coffee"), "brewCoffee");
+/// ```
#[macro_export]
macro_rules! camel_case {
($input:expr) => {{
@@ -6,6 +14,14 @@ macro_rules! camel_case {
}};
}
+/// Convert to UPPER CASE format (BREW COFFEE)
+///
+/// # Examples
+///
+/// ```
+/// # use string_proc::upper_case;
+/// assert_eq!(upper_case!("brew coffee"), "BREW COFFEE");
+/// ```
#[macro_export]
macro_rules! upper_case {
($input:expr) => {{
@@ -14,6 +30,14 @@ macro_rules! upper_case {
}};
}
+/// Convert to lower case format (brew coffee)
+///
+/// # Examples
+///
+/// ```
+/// # use string_proc::lower_case;
+/// assert_eq!(lower_case!("BREW COFFEE"), "brew coffee");
+/// ```
#[macro_export]
macro_rules! lower_case {
($input:expr) => {{
@@ -22,6 +46,14 @@ macro_rules! lower_case {
}};
}
+/// Convert to Title Case format (Brew Coffee)
+///
+/// # Examples
+///
+/// ```
+/// # use string_proc::title_case;
+/// assert_eq!(title_case!("brew_coffee"), "Brew Coffee");
+/// ```
#[macro_export]
macro_rules! title_case {
($input:expr) => {{
@@ -30,6 +62,14 @@ macro_rules! title_case {
}};
}
+/// Convert to dot.case format (brew.coffee)
+///
+/// # Examples
+///
+/// ```
+/// # use string_proc::dot_case;
+/// assert_eq!(dot_case!("brew_coffee"), "brew.coffee");
+/// ```
#[macro_export]
macro_rules! dot_case {
($input:expr) => {{
@@ -38,6 +78,14 @@ macro_rules! dot_case {
}};
}
+/// Convert to snake_case format (brew_coffee)
+///
+/// # Examples
+///
+/// ```
+/// # use string_proc::snake_case;
+/// assert_eq!(snake_case!("brewCoffee"), "brew_coffee");
+/// ```
#[macro_export]
macro_rules! snake_case {
($input:expr) => {{
@@ -46,6 +94,14 @@ macro_rules! snake_case {
}};
}
+/// Convert to kebab-case format (brew-coffee)
+///
+/// # Examples
+///
+/// ```
+/// # use string_proc::kebab_case;
+/// assert_eq!(kebab_case!("brew_coffee"), "brew-coffee");
+/// ```
#[macro_export]
macro_rules! kebab_case {
($input:expr) => {{
@@ -54,6 +110,14 @@ macro_rules! kebab_case {
}};
}
+/// Convert to PascalCase format (BrewCoffee)
+///
+/// # Examples
+///
+/// ```
+/// # use string_proc::pascal_case;
+/// assert_eq!(pascal_case!("brew_coffee"), "BrewCoffee");
+/// ```
#[macro_export]
macro_rules! pascal_case {
($input:expr) => {{