View Source Ext.String (ext v1.4.0)

Ext.String provides helper functions related to strings.

Summary

Functions

Returns true if and only if the input is nil or a zero-length string.

Returns false if and only if the input is a string with non-zero length.

Functions

is_empty?(str)

@spec is_empty?(binary() | nil) :: boolean()

Returns true if and only if the input is nil or a zero-length string.

Examples

iex> Ext.String.is_empty?(nil)
true

iex> Ext.String.is_empty?("")
true

iex> Ext.String.is_empty?("  ")
false

iex> Ext.String.is_empty?("hello")
false

is_not_empty?(str)

@spec is_not_empty?(binary() | nil) :: boolean()

Returns false if and only if the input is a string with non-zero length.

Examples

iex> Ext.String.is_not_empty?(nil)
false

iex> Ext.String.is_not_empty?("")
false

iex> Ext.String.is_not_empty?("  ")
true

iex> Ext.String.is_not_empty?("hello")
true