So i have this array of errorcodes
"codes": [ 597, 197, 120, 113 ]
that I'm trying to combine into one string with a delimiter of "-". I was hoping to try to use $join() but since it only accepts array of string, it will not work. Is there any workaround to join these integers or like convert it into an array of string instead?
Output that I'm looking for:
597-197-120-113
As you say, the $join function only works for an array of strings.
You should therefore transform the numbers array first into a string array by using the $map
function.
This number
array to string
array conversion is shown as a usage example in the $map()
function's documentation.
$join($map(codes, $string), "-")
outputs
"597-197-120-113"