Case conversion library for camel case, snake case, etc. A Perl port of the Clojure library CamelSnakeKebab.
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib/String
t
.gitignore
.travis.yml
Build.PL
Changes
LICENSE
META.json
README.md
cpanfile
cpanfile.snapshot
minil.toml

README.md

Build Status Coverage Status

NAME

String::CamelSnakeKebab - word case conversion

SYNPOSIS

use String::CamelSnakeKebab qw/:all/;

lower_camel_case 'flux-capacitor'
# => 'fluxCapacitor

upper_camel_case 'flux-capacitor'
# => 'FluxCapacitor

lower_snake_case 'ASnakeSlithersSlyly'
# => 'a_snake_slithers_slyly'

upper_snake_case 'ASnakeSlithersSlyly'
# => 'A_Snake_Slithers_Slyly'

constant_case "I am constant"
# => "I_AM_CONSTANT"

kebab_case 'Peppers_Meat_Pineapple'
# => 'peppers-meat-pineapple'

http_header_case "x-ssl-cipher"
# => "X-SSL-Cipher"

word_split 'ASnakeSlithersSlyly'
# => ["A", "Snake", "Slithers", "Slyly"]

word_split 'flux-capacitor'
# => ["flux", "capacitor"]

DESCRIPTION

Camel-Snake-Kebab is a Clojure library for word case conversions. This library is ported from the original Clojure.

METHODS

lower_camel_case()

upper_camel_case()

lower_snake_case()

upper_snake_case()

constant_case()

kebab_case()

http_header_case()

word_split()

ERROR HANDLING

Invalid input is usually indicated by returning the empty string. So you may want to check the return value. This happens if you pass in something crazy like "___" or "_-- _" or "". Because what does it mean to lower camel case "_-- _"? I don't know and I don't want to think about it any more.

SEE ALSO

The original Camel Snake Kebab Clojure library: https://github.com/qerub/camel-snake-kebab

AUTHOR

Eric Johnson (kablamo)