2 releases

0.1.1 Nov 23, 2022
0.1.0 Nov 23, 2022

#1684 in Algorithms

Download history 31/week @ 2024-07-22 25/week @ 2024-07-29 22/week @ 2024-08-05 23/week @ 2024-08-12 16/week @ 2024-08-19 18/week @ 2024-08-26 25/week @ 2024-09-02 48/week @ 2024-09-09 19/week @ 2024-09-16 40/week @ 2024-09-23 30/week @ 2024-09-30 94/week @ 2024-10-07 56/week @ 2024-10-14 26/week @ 2024-10-21 44/week @ 2024-10-28 62/week @ 2024-11-04

207 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