Core Function Join
From Sputnik Wiki
(Difference between revisions)
(Created page with "<pre> Join( <array>, <separator> ) </pre> === Description === Join an array into a string with an optional separator. === Parameters === ==== array ==== The array to join. ...") |
(→separator) |
||
Line 16: | Line 16: | ||
Optional; A string to place between each array element. | Optional; A string to place between each array element. | ||
+ | |||
+ | Default is " " a space. | ||
=== Return Value === | === Return Value === |
Revision as of 12:22, 10 November 2011
Join( <array>, <separator> )
Contents |
Description
Join an array into a string with an optional separator.
Parameters
array
The array to join.
separator
Optional; A string to place between each array element.
Default is " " a space.
Return Value
Success - The array merged into a string. Failure - Returns the separator.
Remarks
This does not alter the original array.
Example
$days = Split("Sun,Mon,Tue,Wed,Thu,Fri,Sat", ",") For $day In $days println("Element is: " . $day) Next println("Back together is " . join($days, ":") )
Heres another way of writing it
$days = Split("Sun,Mon,Tue,Wed,Thu,Fri,Sat", ",") For $day In $days println("Element is: " . $day) Next println("Back together is " . $days::join(":") )
Note the :: this will allow a function to be called using the variable its attached to becomes the first param.