PhpAssocMap v1.0.0 PhpAssocMap.Utils View Source

Link to this section Summary

Functions

Converts a key and a value into an associative array association using arrow

Convert a string for a literal string by escaping quotes and wrapping into them

Wraps a value inside specified string

Link to this section Functions

Link to this function

associate(key, value) View Source
associate(binary(), binary()) :: binary()

Converts a key and a value into an associative array association using arrow

## Exemples

  iex> PhpAssocMap.Utils.associate("my_key", "'Some value'")
  "'my_key'=>'Some value'"
Link to this function

stringify(string) View Source
stringify(binary()) :: binary()

Convert a string for a literal string by escaping quotes and wrapping into them

## Exemples

  iex> PhpAssocMap.Utils.stringify("Jon's")
  "'Jon\\'s'"
Link to this function

wrap(string, left) View Source
wrap(binary(), binary()) :: binary()

Wraps a value inside specified string.

Using wrap/2 will wrap both end using the same string. Using the wrap/3 will wrap left with second parameter and right with third

## Exemples

  iex> PhpAssocMap.Utils.wrap("house", "*")
  "*house*"

  iex> PhpAssocMap.Utils.wrap("house", "{", "}")
  "{house}"
Link to this function

wrap(string, left, right) View Source
wrap(binary(), binary(), binary()) :: binary()