Module

Data.String.Extra

Package
purescript-strings-extra
Repository
purescript-contrib/purescript-strings-extra

#camelCase Source

camelCase :: String -> String

Converts a String to camel case

camelCase "Hello world" == "helloWorld"

#kebabCase Source

kebabCase :: String -> String

Converts a String to kebab case

kebabCase "Hello world" == "hello-world"

#pascalCase Source

pascalCase :: String -> String

Converts a String to Pascal case

pascalCase "Hello world" == "HelloWorld"

#snakeCase Source

snakeCase :: String -> String

Converts a String to snake case

snakeCase "Hello world" == "hello_world"

#upperCaseFirst Source

upperCaseFirst :: String -> String

Converts the first character in a String to upper case, lower-casing the rest of the string.

upperCaseFirst "hello World" == "Hello world"

#words Source

words :: String -> Array String

Separates a String into words based on Unicode separators, capital letters, dashes, underscores, etc.

words "Hello_world --from TheAliens" == [ "Hello", "world", "from", "The", "Aliens" ]

#levenshtein Source

levenshtein :: String -> String -> Int

Calculates the Levenshtein distance between two strings.

levenshtein "book" "back" -- 2

#sorensenDiceCoefficient Source

sorensenDiceCoefficient :: String -> String -> Number

Calculates the Sørensen-Dice coefficient between two strings.

sorensenDiceCoefficient "WHIRLED" "WORLD" -- 0.2000