| Crates.io | caseify |
| lib.rs | caseify |
| version | 0.1.1 |
| created_at | 2025-08-05 20:58:28.426606+00 |
| updated_at | 2025-08-07 19:40:42.365536+00 |
| description | A CLI tool to convert strings between different cases |
| homepage | |
| repository | https://github.com/t-webber/caseify |
| max_upload_size | |
| id | 1783090 |
| size | 45,175 |
A fast and simple Rust library and CLI tool for converting strings between different case conventions.
This is a new crate, open to comments and improvements!
Install it with:
cargo install caseify
Then use it as such:
# Convert a single string
caseify --snake "SomeVariableName"
# Output: some_variable_name
# Use with pipes
echo "some text
some_snake_case
AndPascalCase" | caseify --camel
# Output:
# someText
# someSnakeCase
# AndPascalCase
# Process multiple lines
cat file.txt | caseify --pascal
# Available options
caseify --help
Help message:
Usage: caseify [OPTIONS] [VALUE]
Arguments:
[VALUE] If no value is provided, reads from stdin (e.g. for pipes)
Options:
-c, --camel `thisIsCamelCase`
-a, --capitalised `This Is Capitalised Case`
-o, --constant `THIS_IS_CONSTANT_CASE` (or `UPPER_CASE`)
-d, --dot `this.is.dot.case`
-k, --kebab `this-is-kebab-case` (or `dashed-case`)
-p, --pascal `ThisIsPascalCase`
-e, --sentence `This is sentence case`
-s, --snake `this_is_snake_case`
-h, --help Print help
Add it to your Cargo.toml or run:
cargo add caseify
Then use it as such:
use caseify::Caseify;
let input = "lorem Ipsum_dolor.sit-amet";
assert_eq!(input.to_camel_case(), "loremIpsumDolorSitAmet");
assert_eq!(input.to_pascal_case(), "LoremIpsumDolorSitAmet");
assert_eq!(input.to_kebab_case(), "lorem-ipsum-dolor-sit-amet");
assert_eq!(input.to_constant_case(), "LOREM_IPSUM_DOLOR_SIT_AMET");
assert_eq!(input.to_sentence_case(), "Lorem ipsum dolor sit amet");
assert_eq!(input.to_capitalised_case(), "Lorem Ipsum Dolor Sit Amet");
assert_eq!(input.to_dot_case(), "lorem.ipsum.dolor.sit.amet");
The library intelligently handles various input formats:
use caseify::Caseify;
assert_eq!("XMLHttpRequest".to_snake_case(), "xml_http_request");
assert_eq!("linux _Kernel".to_camel_case(), "linuxKernel");
assert_eq!("some--weird___input".to_pascal_case(), "SomeWeirdInput");