{
"id": "fn-array-join",
"dataComponent": "array",
"heading": {
"title": "join",
"badges": ["Array", "PARTIAL"]
},
"synopsis": "Concatenates the elements of a string array using a specified separator, returning a single string. Supports partial usage and underscore placeholders.",
"codeBlocks": [
"extend(\"array\")\n\n# Full usage:\nsput( array:join(\",\", [\"a\",\"b\",\"c\"]) ) # => \"a,b,c\"\n\n# Partial usage (fix the separator):\njoinWithDash = array:join(\"-\")\nsput( joinWithDash([\"alpha\",\"beta\"]) ) # => \"alpha-beta\"\n\n# Partial usage (fix the array):\njoinNumbers = array:join(_, [\"1\",\"2\",\"3\"])\nsput( joinNumbers(\":\")) # => \"1:2:3\"\n\n# Placeholder usage:\npartial = array:join(_, [\"a\",\"b\"])\nsput( partial(\"!\") ) # => \"a!b\""
],
"notes": [
"Arguments:\n- Separator: a string (e.g. \",\" or \":\").\n- Array: a str-array (e.g. [\"a\", \"b\", \"c\"]).",
"You may partially apply `array:join`, fixing either the separator or the array first. Placeholders (`_`) are supported for either parameter.",
"If both arguments are provided, returns the joined string. If only one argument is given, returns a function waiting for the missing argument.",
"If the second argument is a single string, returns it unchanged."
]
}