Cldr.Map.underscore

You're seeing just the function underscore, go back to Cldr.Map module for more information.

Specs

underscore(string :: String.t() | atom()) :: String.t()

Convert a camelCase string or atom to a snake_case

  • string is a String.t or atom() to be transformed

This is the code of Macro.underscore with modifications. The change is to cater for strings in the format:

This_That

which in Macro.underscore gets formatted as

this__that (note the double underscore)

when we actually want

that_that

Examples

iex> Cldr.Map.underscore "thisThat"
"this_that"

iex> Cldr.Map.underscore "This_That"
"this_that"