Cased.Sensitive.String (cased v1.0.0)
Used to mask sensitive string values.
Link to this section Summary
Functions
Check two sensitive strings for equality.
Extract all {begin_offset, end_offset}
values for matches of a given regular expression.
Create a new Cased.Sensitive.String
struct.
Link to this section Types
Link to this type
new_opt()
Specs
Link to this type
new_opts()
Specs
new_opts() :: [new_opt()]
Specs
Link to this section Functions
Link to this function
equal?(string1, string2)
Specs
Check two sensitive strings for equality.
Examples
Two strings with the same data and label are equivalent:
iex> string1 = Cased.Sensitive.String.new("text", label: "username")
iex> string2 = Cased.Sensitive.String.new("text", label: "username")
iex> Cased.Sensitive.String.equal?(string1, string2)
true
If the contents are different, two sensitive strings are not equal:
iex> string1 = Cased.Sensitive.String.new("text", label: "username")
iex> string2 = Cased.Sensitive.String.new("txet", label: "username")
iex> Cased.Sensitive.String.equal?(string1, string2)
false
If the labels are different, two sensitive strings are not equal:
iex> string1 = Cased.Sensitive.String.new("text", label: "username")
iex> string2 = Cased.Sensitive.String.new("text", label: "email")
iex> Cased.Sensitive.String.equal?(string1, string2)
false
Link to this function
matches(string, regex)
Specs
matches(string :: t(), regex :: Regex.t()) :: [ {non_neg_integer(), non_neg_integer()} ]
Extract all {begin_offset, end_offset}
values for matches of a given regular expression.
Examples
Cased.Sensitive.String.new("Hello @username and @username")
|> Cased.Sensitive.String.matches(~r/@w+/)
# => [{6, 15}, {20, 29}]
Link to this function
new(raw_string, opts \\ [])
Specs
Create a new Cased.Sensitive.String
struct.
Example
Cased.Sensitive.String.new("john@example.com", label: :email)
Link to this function