View Source PhpAssocMap.Utils (PhpAssocMap v2.0.1)

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.

Functions

@spec 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'"
@spec 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'"
@spec 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
@spec wrap(binary(), binary(), binary()) :: binary()