2 个版本

0.1.1 2022 年 11 月 23 日
0.1.0 2022 年 11 月 23 日

#1622 in 算法

Download history 59/week @ 2024-03-04 13/week @ 2024-03-11 9/week @ 2024-03-18 4/week @ 2024-03-25 40/week @ 2024-04-01 13/week @ 2024-04-08 17/week @ 2024-04-15 33/week @ 2024-04-22 89/week @ 2024-04-29 54/week @ 2024-05-06 44/week @ 2024-05-13 60/week @ 2024-05-20 31/week @ 2024-05-27 47/week @ 2024-06-03 36/week @ 2024-06-10 22/week @ 2024-06-17

141 次每月下载
用于 find-typos

MIT 许可证

8KB
107

案例转换器

  • 将 snake case 转换为 camel case
  • 将 kebab case 转换为 camel case
  • 将 camel case 转换为 snake case
  • 将 camel case 转换为 kebab case
  • 将 kebab case 转换为 snake case
  • 将 snake case 转换为 kebab case

安装说明

cargo add case_converter

将 snake case 转换为 camel case 的示例

use case_converter::snake_to_camel;

fn main() {
    let result = snake_to_camel("snake_to_camel");
    println!("{}", result); // → snakeToCamel
}

将 kebab case 转换为 camel case 的示例

use case_converter::kebab_to_camel;

fn main() {
    let result = kebab_to_camel("kebab-to-camel");
    println!("{}", result); // → kebabToCamel
}

将 camel case 转换为 snake case 的示例

use case_converter::camel_to_snake;

fn main() {
    let result = camel_to_snake("camelToSnake");
    println!("{}", result); // → camel_to_snake
}

将 camel case 转换为 kebab case 的示例

use case_converter::camel_to_kebab;

fn main() {
    let result = camel_to_kebab("camelToKebab");
    println!("{}", result); // → camel-to-kebab
}

将 kebab case 转换为 snake case 的示例

use case_converter::kebab_to_snake;

fn main() {
    let result = kebab_to_snake("kebab-to-snake");
    println!("{}", result); // → kebab_to_snake
}

将 snake case 转换为 kebab case 的示例

use case_converter::snake_to_kebab;

fn main() {
    let result = snake_to_kebab("snake_to_kebab");
    println!("{}", result); // → snake-to-kebab
}

无运行时依赖