summaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-02-13 01:55:52 +0800
committer魏曹先生 <1992414357@qq.com>2026-02-13 02:03:50 +0800
commitabc9507b3f844144eb556f17cf5c98d2d8448518 (patch)
tree9d28d75fa8cc98152da29fb8bb8b556c1d67fee9 /src/lib.rs
First
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
new file mode 100644
index 0000000..6c486d7
--- /dev/null
+++ b/src/lib.rs
@@ -0,0 +1,48 @@
+/// Format naming styles
+///
+/// Provides multiple naming style conversion functions, supporting conversion from input strings
+/// in different formats to standardized word lists, then outputting to various common naming styles.
+///
+/// # Main Features
+///
+/// - Create `CaseFormatter` from a string
+/// - Intelligently split input strings into word lists, handling multiple separators and case boundaries
+/// - Convert to multiple naming formats: `camelCase`, `PascalCase`, `snake_case`, `kebab-case`, etc.
+///
+/// # Examples
+///
+/// ```
+/// # use just_fmt::fmt_case::CaseFormatter;
+/// // Using CaseFormatter
+/// let formatter = CaseFormatter::from("brew_coffee");
+/// assert_eq!(formatter.to_camel_case(), "brewCoffee");
+/// assert_eq!(formatter.to_pascal_case(), "BrewCoffee");
+/// assert_eq!(formatter.to_snake_case(), "brew_coffee");
+/// assert_eq!(formatter.to_kebab_case(), "brew-coffee");
+///
+/// // Using macros
+/// # use just_fmt::fmt_case::{camel_case, pascal_case, snake_case, kebab_case}
+/// assert_eq!(camel_case!("brew coffee"), "brewCoffee");
+/// assert_eq!(pascal_case!("brewCoffee"), "BrewCoffee");
+/// assert_eq!(snake_case!("brew_coffee"), "brew_coffee");
+/// assert_eq!(kebab_case!("brew.Coffee"), "brew-coffee");
+/// ```
+///
+/// # Supported Input Separators
+///
+/// The module can recognize the following characters as word separators:
+/// - Underscore `_`
+/// - Comma `,`
+/// - Dot `.`
+/// - Hyphen `-`
+/// - Space ` `
+///
+/// It can also automatically detect case boundaries (e.g., "camel" and "Case" in "camelCase")
+pub mod fmt_case_style;
+
+/// Normalize an input path string into a canonical, platform‑agnostic form.
+///
+/// This function removes ANSI escape sequences, unifies separators to `/`,
+/// collapses duplicate slashes, strips unfriendly characters (`*`, `?`, `"`, `<`, `>`, `|`),
+/// resolves simple `..` components, and preserves a trailing slash when present.
+pub mod fmt_path;