lodash v0.0.3 Lodash.String
Specialized functions to manipulate Strings.
Summary
Functions
Converts str
to camel case
Deburrs str
by converting unicode into ascii
Converts str
to kebab case
Converts str
to lower case
Convert str
by to pascal case
Converts str
to snake case
Converts str
to start case
Truncates str
if it’s longer than the given maximum string length. The last characters of the truncated string are replaced with the omission string which defaults to “…”
Split str
into an array of its words
Functions
Converts str
to camel case
Examples
iex> Lodash.String.camel_case("Foo Bar")
"fooBar"
iex> Lodash.String.camel_case("--foo-bar--")
"fooBar"
iex> Lodash.String.camel_case("__FOO_BAR__")
"fooBar"
Deburrs str
by converting unicode into ascii.
Examples
iex> Lodash.String.deburr("minh quý")
"minh quy"
Converts str
to kebab case
Examples
iex> Lodash.String.kebab_case("Foo Bar")
"foo-bar"
iex> Lodash.String.kebab_case("--foo-bar--")
"foo-bar"
iex> Lodash.String.kebab_case("__FOO_BAR__")
"foo-bar"
Converts str
to lower case
Examples
iex> Lodash.String.lower_case("Foo Bar")
"foo bar"
iex> Lodash.String.lower_case("--foo-bar--")
"foo bar"
iex> Lodash.String.lower_case("__FOO_BAR__")
"foo bar"
Convert str
by to pascal case.
Examples
iex> Lodash.String.pascal_case("Foo Bar")
"FooBar"
iex> Lodash.String.pascal_case("--foo-bar--")
"FooBar"
iex> Lodash.String.pascal_case("__FOO_BAR__")
"FooBar"
Converts str
to snake case
Examples
iex> Lodash.String.snake_case("Foo Bar")
"foo_bar"
iex> Lodash.String.snake_case("--foo-bar--")
"foo_bar"
iex> Lodash.String.snake_case("__FOO_BAR__")
"foo_bar"
Converts str
to start case
Examples
iex> Lodash.String.start_case("Foo Bar")
"Foo Bar"
iex> Lodash.String.start_case("--foo-bar--")
"Foo Bar"
iex> Lodash.String.start_case("__FOO_BAR__")
"Foo Bar"
Truncates str
if it’s longer than the given maximum string length. The last characters of the truncated string are replaced with the omission string which defaults to “…”
Examples
iex> Lodash.String.truncate("hi-minh quy")
"hi-minh quy"
iex> Lodash.String.truncate("hi-minh quy", length: 4)
"h..."
iex> Lodash.String.truncate("hi-minh quy", length: 10, separator: ~r/ /)
"hi-minh..."
iex> Lodash.String.truncate("hi-minh quy", length: 10, omission: " ...")
"hi-min ..."
Split str
into an array of its words.
Examples
iex> Lodash.String.words("fred, barney, & pebbles")
["fred", "barney", "pebbles"]
iex> Lodash.String.words("fred, barney, & pebbles", ~r/[^, ]+/)
["fred", "barney", "&", "pebbles"]