2021-02-24 06:14:10 +01:00
|
|
|
{
|
|
|
|
"name": "array_replace",
|
|
|
|
"type": "function",
|
2021-02-24 21:57:03 +01:00
|
|
|
"groups": ["Arrays"],
|
2021-02-24 06:14:10 +01:00
|
|
|
"description": "Returns an array with the supplied value, array, or map of values replaced.",
|
|
|
|
"variants": [
|
|
|
|
{ "variant": "Value & array variant",
|
|
|
|
"variant_description": "Returns an array with the supplied value or array of values replaced by another value or an array of values.",
|
|
|
|
"arguments": [ {"arg":"array","description":"the input array"},
|
|
|
|
{"arg":"before","description":"the value or array of values to replace"},
|
|
|
|
{"arg":"after","description":"the value or array of values to use as a replacement"}],
|
|
|
|
"examples": [ { "expression":"array_replace(array('QGIS','SHOULD','ROCK'),'SHOULD','DOES')", "returns":"[ 'QGIS', 'DOES', 'ROCK' ]"},
|
|
|
|
{ "expression":"array_replace(array(3,2,1),array(1,2,3),array(7,8,9))", "returns":"[ 9, 8, 7 ]"},
|
|
|
|
{ "expression":"array_replace(array('Q','G','I','S'),array('Q','S'),'-')", "returns":"[ '-', 'G', 'I', '-' ]"} ] },
|
|
|
|
{ "variant": "Map variant",
|
|
|
|
"variant_description": "Returns an array with the supplied map keys replaced by their paired values.",
|
|
|
|
"arguments": [ {"arg":"array","description":"the input array"},
|
|
|
|
{"arg":"map","description":"the map containing keys and values"} ],
|
|
|
|
"examples": [ { "expression":"array_replace(array('APP', 'SHOULD', 'ROCK'),map('APP','QGIS','SHOULD','DOES'))", "returns":"[ 'QGIS', 'DOES', 'ROCK' ]"} ]
|
|
|
|
}]
|
|
|
|
}
|