ExTwilio v0.1.7 ExTwilio.Utils
Provides camelize/1
and underscore/1
functions. Stolen from ExTwilio.Utils.
Summary
Functions
Converts the given string to CamelCase format
Converts the given atom or binary to underscore format. If an atom is given, it is assumed to be an Elixir module, so it is converted to a binary and then processed
Functions
Converts the given string to CamelCase format.
Examples
iex> ExTwilio.Utils.camelize "foo_bar"
"FooBar"
Converts the given atom or binary to underscore format. If an atom is given, it is assumed to be an Elixir module, so it is converted to a binary and then processed.
Examples
iex> ExTwilio.Utils.underscore "FooBar"
"foo_bar"
iex> ExTwilio.Utils.underscore "Foo.Bar"
"foo/bar"
iex> ExTwilio.Utils.underscore Foo.Bar
"foo/bar"
In general, underscore
can be thought of as the reverse of camelize
, however, in some cases formatting may be lost:
iex> ExTwilio.Utils.underscore "SAPExample"
"sap_example"
iex> ExTwilio.Utils.camelize "sap_example"
"SapExample"