2 releases

0.1.1 Nov 23, 2022
0.1.0 Nov 23, 2022

#1625 in Algorithms

Download history 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 37/week @ 2024-06-24

146 downloads per month
Used in find-typos

MIT license

8KB
107 lines

Case Converter

  • Convert snake case to camel case
  • Convert kebab case to camel case
  • Convert camel case to snake case
  • Convert camel case to kebab case
  • Convert kebab case to snake case
  • Convert snake case to kebab case

Installation

cargo add case_converter

Example for Convert snake case to camel case

use case_converter::snake_to_camel;

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

Example for Convert kebab case to camel case

use case_converter::kebab_to_camel;

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

Example for Convert camel case to snake case

use case_converter::camel_to_snake;

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

Example for Convert camel case to kebab case

use case_converter::camel_to_kebab;

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

Example for Convert kebab case to snake case

use case_converter::kebab_to_snake;

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

Example for Convert snake case to kebab case

use case_converter::snake_to_kebab;

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

No runtime deps