Converts String
to lowerCamelCase
, UpperCamelCase
and snake_case
.
let input = "Keynote Event"
input.lowerCamelCased() // "keynoteEvent"
input.upperCamelCased() // "KeynoteEvent"
input.snakeCased() // "keynote_event"
let input = "_this is* not-Very%difficult"
input.lowerCamelCased() // "thisIsNotVeryDifficult"
input.upperCamelCased() // "ThisIsNotVeryDifficult"
input.snakeCased() // "this_is_not_very_difficult"
"KeynoteEvent".isLowerCamelCased // false
"keynoteEvent".isLowerCamelCased // true
"keynote_event".isLowerCamelCased // false
"KeynoteEvent".isUpperCamelCased // true
"keynoteEvent".isUpperCamelCased // false
"keynote_event".isUpperCamelCased // false
"KeynoteEvent".isSnakeCase // false
"keynoteEvent".isSnakeCase // false
"keynote_event".isSnakeCase // true
- Devran "Cosmo" Uenal
- Twitter: @maccosmo
StringCase is released under the MIT License.