#snake-case #pascal-case #title-case #camelcase #swapcase

change-case

在 camelCase、PascalCase、Capital Case、snake_case、param-case、CONSTANT_CASE 等之间转换字符串

4 个版本

0.2.0 2020年9月10日
0.1.2 2020年9月9日
0.1.1 2020年9月9日
0.1.0 2020年9月9日

#5 in #title-case

Download history 406/week @ 2024-03-13 184/week @ 2024-03-20 190/week @ 2024-03-27 388/week @ 2024-04-03 565/week @ 2024-04-10 335/week @ 2024-04-17 331/week @ 2024-04-24 359/week @ 2024-05-01 449/week @ 2024-05-08 348/week @ 2024-05-15 255/week @ 2024-05-22 531/week @ 2024-05-29 400/week @ 2024-06-05 402/week @ 2024-06-12 500/week @ 2024-06-19 540/week @ 2024-06-26

1,934 每月下载量
用于 9 个 crate (6 直接)

MIT 许可证

24KB
327

Change Case

Build status crates.io Documentation Rust

camelCasePascalCaseCapital Casesnake_caseparam-caseCONSTANT_CASE 等之间转换字符串。

用法

将其添加到您的 Cargo.toml

[dependencies]
change-case = "0.1"
use change_case::*;

assert_eq!(camel_case("Test String"), "testString");
assert_eq!(captial_case("test string"), "Test String");
assert_eq!(constant_case("test string"), "TEST_STRING");
assert_eq!(dot_case("test string"), "test.string");
assert_eq!(header_case("test string"), "Test-String");
assert_eq!(param_case("test string"), "test-string");
assert_eq!(pascal_case("test string"), "TestString");
assert_eq!(path_case("test string"), "test/string");
assert_eq!(sentence_case("Test String"), "Test string");
assert_eq!(snake_case("Test String"), "test_string");
assert_eq!(swap_case("Test String"), "tEST sTRING");
assert_eq!(title_case("this vs that"), "This vs That");

许可证

MIT

依赖

~2.5–3.5MB
~61K SLoC