Copyright | (c) Marshall Bowers 2019 |
---|---|
License | MIT |
Maintainer | elliott.codes@gmail.com |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell2010 |
Description
Contains case conversion functions.
Synopsis
- toCamelCase :: String -> String
- toPascalCase :: String -> String
- toSnakeCase :: String -> String
- toScreamingSnakeCase :: String -> String
- toKebabCase :: String -> String
- toTitleCase :: String -> String
Documentation
toCamelCase :: String -> String Source #
Converts the given string to camelCase.
In camelCase each word starts with an uppercase letter except for the first word, which starts with a lowercase letter.
>>>
toCamelCase "Hello World"
"helloWorld"
>>>
toCamelCase "Player ID"
"playerId"
>>>
toCamelCase "XMLHttpRequest"
"xmlHttpRequest"
toPascalCase :: String -> String Source #
Converts the given string to PascalCase.
In PascalCase the first letter of each word is uppercase.
>>>
toPascalCase "Hello World"
"HelloWorld"
>>>
toPascalCase "Player ID"
"PlayerId"
>>>
toPascalCase "XMLHttpRequest"
"XmlHttpRequest"
toSnakeCase :: String -> String Source #
Converts the given string to snake_case.
In snake_case all letters are lowercase and each word is separated by an underscore ("_").
>>>
toSnakeCase "Hello World"
"hello_world"
>>>
toSnakeCase "Player ID"
"player_id"
>>>
toSnakeCase "XMLHttpRequest"
"xml_http_request"
toScreamingSnakeCase :: String -> String Source #
Converts the given string to SCREAMING_SNAKE_CASE.
In SCREAMING_SNAKE_CASE all letters are uppercase and each word is separated by an underscore ("_").
>>>
toScreamingSnakeCase "Hello World"
"HELLO_WORLD"
>>>
toScreamingSnakeCase "Player ID"
"PLAYER_ID"
>>>
toScreamingSnakeCase "XMLHttpRequest"
"XML_HTTP_REQUEST"
toKebabCase :: String -> String Source #
Converts the given string to kebab-case.
In kebab-case all letters are lowercase and each word is separated by a hyphen ("-").
>>>
toKebabCase "Hello World"
"hello-world"
>>>
toKebabCase "Player ID"
"player-id"
>>>
toKebabCase "XMLHttpRequest"
"xml-http-request"
toTitleCase :: String -> String Source #
Converts the given string to Title Case.
In Title Case the first letter of each word is uppercase and each word is separated by a space (" ").
>>>
toTitleCase "Hello World"
"Hello World"
>>>
toTitleCase "Player ID"
"Player Id"
>>>
toTitleCase "XMLHttpRequest"
"Xml Http Request"