Core Function Join

From Sputnik Wiki
Revision as of 12:22, 10 November 2011 by UberFoX (Talk | contribs)
Jump to: navigation, search
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.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox