Inflex v2.1.0 Inflex View Source

Link to this section Summary

Functions

Camelizes or pascalizes strings and atoms to upper-case CamelCase.

Camelizes or pascalizes strings and atoms.

Inflect on the plurality of a word given some count.

Converts an integer to a ordinal value.

Parameterize a string using a hyphen (-) separator. If you want to return as only ascii characters, use parameterize_to_ascii/2

Parameterize a string given some separator. If you want to return as only ascii characters, use parameterize_to_ascii/2

Parameterize a string using a hyphen (-) separator, returning only ascii characters.

Parameterize a string given some separator, returning only ascii characters.

Pluralize a word.

Singularize a word.

Underscore and lowercase a string.

Link to this section Functions

Camelizes or pascalizes strings and atoms to upper-case CamelCase.

Examples

iex> Inflex.camelize(:upper_camel_case)
"UpperCamelCase"

Camelizes or pascalizes strings and atoms.

Options

  • :lower - Lower-cases the first letter.

Examples

iex> Inflex.camelize("pascal-case", :lower)
"pascalCase"

Inflect on the plurality of a word given some count.

Examples

iex> Inflex.inflect("child", 1)
"child"

iex> Inflex.inflect("child", 2)
"children"

Converts an integer to a ordinal value.

Examples

iex> Inflex.ordinalize(1)
"1st"

iex> Inflex.ordinalize(11)
"11th"

Parameterize a string using a hyphen (-) separator. If you want to return as only ascii characters, use parameterize_to_ascii/2

Examples

iex> Inflex.parameterize("String for parameter")
"string-for-parameter"
Link to this function

parameterize(word, option)

View Source

Parameterize a string given some separator. If you want to return as only ascii characters, use parameterize_to_ascii/2

The option argument is a string representing the character that will be used as the separator.

Examples

iex> Inflex.parameterize("String with underscore", "_")
"string_with_underscore"
Link to this function

parameterize_to_ascii(word)

View Source

Parameterize a string using a hyphen (-) separator, returning only ascii characters.

Examples

iex> Inflex.parameterize_to_ascii("String for parameter 😎")
"string-for-parameter-"
Link to this function

parameterize_to_ascii(word, option)

View Source

Parameterize a string given some separator, returning only ascii characters.

The option argument is a string representing the character that will be used as the separator.

Examples

iex> Inflex.parameterize_to_ascii("String with underscore 😎", "_")
"string_with_underscore_"

Pluralize a word.

Examples

iex> Inflex.pluralize("dog")
"dogs"

iex> Inflex.pluralize("person")
"people"

Singularize a word.

Examples

iex> Inflex.singularize("dogs")
"dog"

iex> Inflex.singularize("people")
"person"

Underscore and lowercase a string.

Examples

iex> Inflex.underscore("UpperCamelCase")
"upper_camel_case"

iex> Inflex.underscore(:pascalCase)
"pascal_case"