Fox.StringExt

Source

Summary

camelize(string)

Takes a string and makes it camel-cased. Note that “/“ become periods “.”

consume!(meal, bite)
consume(meal, bite)

Takes a string consume from the left a portion of the string and returns the remaining string

float?(string)
integer?(string)
next_grapheme(string)
next_grapheme(string, arg2)
number?(string)
pluralize(noun)

Takes a singular word and returns the plural form

random()

Generates a random string of length n. Defaults to n = 10

random(n)
reverse_consume!(meal, bite)
reverse_consume(meal, bite)
singularize(nouns)

Takes a word and returns its singular form

to_url(string)

Takes a string and builds it into an url-friendly string, good for permalinks and generally being passed around in the browser

transformations()
transformify(arg1)
underscore(string)

Takes a string and makes it underscored. This is the semi-inverse of camelize. Note that because this is Elixir and not ruby, periods become “/“, not “::”

Functions

camelize(string)

Takes a string and makes it camel-cased. Note that “/“ become periods “.”

Examples

“under_scored” |> camelize # UnderScored

# acronyms are not restored by camelize (lol obviously) “acronym_hiv” |> camelize # AcronymHiv

# spaces are ignored “sakidasu kasa no mure ni” |> camelize # Sakidasu kasa no mure ni

“my_app/module/sub_module” |> camelize # MyApp.Module.SubModule

Source
consume(meal, bite)

Takes a string consume from the left a portion of the string and returns the remaining string

Source
consume!(meal, bite)
Source
float?(string)
Source
integer?(string)
Source
next_grapheme(string)
Source
next_grapheme(string, arg2)
Source
number?(string)
Source
pluralize(noun)

Takes a singular word and returns the plural form

Source
random()

Generates a random string of length n. Defaults to n = 10

Source
random(n)
Source
reverse_consume(meal, bite)
Source
reverse_consume!(meal, bite)
Source
singularize(nouns)

Takes a word and returns its singular form

Source
to_url(string)

Takes a string and builds it into an url-friendly string, good for permalinks and generally being passed around in the browser

Source
transformations()
Source
transformify(arg1)
Source
underscore(string)

Takes a string and makes it underscored. This is the semi-inverse of camelize. Note that because this is Elixir and not ruby, periods become “/“, not “::”

Examples

“CamelCase” |> underscore # camel_case

“AcronymHIV” |> underscore # acronym_hiv

“dasher-ized” |> underscore # dasher_ized

# Spaces are ignored (following rails convention) “regular words” |> underscore # regular words

“MyApp.Module.SubModule” |> underscore # my_app/module/sub_module

Source