Skip to content

Instantly share code, notes, and snippets.

View magicink's full-sized avatar
👋

Brandon Tom magicink

👋
  • Geocaching HQ
  • Seattle, Washington
  • X @magicink
View GitHub Profile
@magicink
magicink / main.rs
Last active March 26, 2022 15:41
Converts an unsanitary, space delimited string into a camel case string, then to a format with custom delimiters, then back to camel case.
// define a constant string with the value "hello world"
const HELLO_WORLD: &str = "Hello, World!";
fn main() {
// sanitize HELLO_WORLD
let camel_cased: String = to_camelcase(&HELLO_WORLD.to_lowercase());
println!("{}", camel_cased); // helloWorld
let dash_delimited = camelcase_to_delimiter_seperated(&camel_cased, "-");
println!("{}", dash_delimited); // hello-world
let recamel_cased = to_camelcase(&dash_delimited);
println!("{}", recamel_cased); // helloWorld
### Keybase proof
I hereby claim:
* I am magicink on github.
* I am magicink (https://keybase.io/magicink) on keybase.
* I have a public key whose fingerprint is 17A3 218E 107D 159C 43C6 C6F0 9F5D 640A 8F6E E3D4
To claim this, I am signing this object: