Henchman
A set of helpers for elixir.
Installation
Add henchman to your list of dependencies in mix.exs:
def deps do
[{:henchman, "~> 0.3.0"}]
endUsage
Henchman provides a set helpers that will come in handy.
Randomizer
Generate random string for a specific length. There are 4 types supported:
:alphanumeric- Random alphanumeric string:numeric- Random numeric only string:upper- Random non-numeric only string:lower- Random non-numeric only string
iex> Henchman.Randomizer.generate(20) #generate alphanumeric string
iex> Henchman.Randomizer.generate(20, :numeric) #generate numeric only stringString Helpers
acronym/1
Generate acronym from string.
iex> Henchman.String.acronym("foo bar")#FBcamel_case/1
Convert string to camelCase.
iex> Henchman.String.camel_case("foo-bar")#fooBaris_alpha?/1
Determine if string contains alphabets only.
iex> Henchman.String.is_alpha?("fooBAR")#trueis_alphanumeric?/1
Determine if string contains alphabets and integers.
iex> Henchman.String.is_alphanumeric?("123fooBAR")#trueis_blank?/1
Determine if string is blank.
iex> Henchman.String.is_blank?("")#trueis_lowercase?/1
Determine if string contains lower case characters only.
iex> Henchman.String.is_lowercase?("foo")#trueis_numeric?/1
Determine if string contains integers only.
iex> Henchman.String.is_numeric?("123")#trueis_uppercase?/1
Determine if string contains upper case characters only.
iex> Henchman.String.is_uppercase?("BAR")#trueslug/1 or slug/2
Convert string to slug format.
iex> Henchman.String.slug("Foo bar")#foo-bar
iex> Henchman.String.slug("Foo bar", "_")#foo_barsnake_case/1 or snake_case/2
Convert string to snake_case.
iex> Henchman.String.snake_case("FooBar")#foo_bar
iex> Henchman.String.snake_case("FooBar", "-")#foo-barstudly_case/1
Convert string to StudlyCase.
iex> Henchman.String.studly_case("foo-bar")#FooBartitle_case/1
Capitalize every first letters in a string.
iex> Henchman.String.title_case("foo bar-baz")#Foo Bar-bazlimit/2 or word_limit/2
The string module can either truncate characters or words within a string.
iex> Henchman.String.limit("Foo bar baz baz", 10)#Foo bar ba....
iex> Henchman.String.word_limit("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", 7)#Lorem ipsum dolor sit amet, consectetur adipiscing...License
Released under the MIT license - see LICENSE for details.