View Source Cldr.String (cldr_utils v2.18.0)

Functions that operate on a String.t that are not provided in the standard lib.

Link to this section Summary

Functions

Hash a string using a polynomial rolling hash function.

Replaces "-" with "_" in a string.

This is the code of Macro.underscore with modifications

Link to this section Functions

Hash a string using a polynomial rolling hash function.

See https://cp-algorithms.com/string/string-hashing.html for a description of the algoithim.

Replaces "-" with "_" in a string.

Examples

iex> Cldr.String.to_underscore("this-one")
"this_one"

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