LassoScript Utility
Basics Browse Detail

[Array->Join]

Tag Link [Array->Join] Category Array
Type Member Source Available No
Support Preferred Version 6.0
Change Unchanged Data Source Any
Output Type String Security Tag
Implementation LCAPI Sets Lasso 8.5, Lasso 8.0, Lasso 7.0, Lasso 6.0

Description

The [Array->Join] tag concatenates (or adds) each of the elements of an array together. An optional parameter specifies a value that should be concatenated between each element of the array.

The [Array->Join] tag uses the + symbol to combine the element of the array and the optional parameter. If all the elements of the array are integers then a sum will be performed [(Array: 1, 2, 3)->Join] -> 6.

Usually, the parameter to the [Array->Join] tag is a string. This forces a string concatenation to occur so that the result is a string [(Array, 1, 2, 3)->(Join: ' ')] -> '1 2 3'. A non-empty string should always be specified as the [Array->Join] parameter if a string result is desired.

If the array only contains a single element then that element will be returned and no concatenation or addition is performed. If desired the [String] tag can be used to force the result to be a string.

Syntax

[Array->(Join: 'String')]

[Array->(Join: ' ')]

[Array->(Join: ', ')]

[Output: '\'' + Array->(Join: '\',\'') + '\'']

[(Array: 1, 2, 3)->(Join: 0)]

Parameters

Optional Parameters
String Delimiter A string which will be inserted between each element of the joined array.

Examples

To join an array into a string:

Use the [Array->Join] tag.

In the following example a URL is divided into segments on the ampersand character using the [Array->Split] tag. A new name/value pair is added to the array then the array is rejoined using [Array->Join].

[Variable: 'myURL' = 'http://www.example.com/Default.Lasso?-Database=Contacts&-Table=People&-Search']
[Variable: 'myArray' = $myURL->(Split: '&')]
[$myArray->(Insert: 'First_Name=J')]
[Variable: 'myURL' = $myArray->(Join: '&')]
[Output: $myURL]

http://www.example.com/Default.Lasso?-Database=Contacts&-Table=People&-Search&First_Name=J

Related Tags

Category Tags

Substitution
[Iterator]
[List]
[Map]
[Pair]
[PriorityQueue]
[Queue]
[ReverseIterator]
[Series]
[Set]
[Stack]
[TreeMap]
Member
[Iterator->AtBegin]
[Iterator->AtBottom]
[Iterator->AtEnd]
[Iterator->AtFarLeft]
[Iterator->AtFarRight]
[Iterator->AtTop]
[Iterator->Backward]
[Iterator->Down]
[Iterator->Forward]
[Iterator->InsertAtCurrent]
[Iterator->Key]
[Iterator->Left]
[Iterator->RemoveCurrent]
[Iterator->Reset]
[Iterator->Right]
[Iterator->Up]
[Iterator->Value]
[List->Contains]
[List->Difference]
[List->Find]
[List->FindPosition]
[List->First]
[List->ForEach]
[List->Get]
[List->Insert]
[List->InsertFirst]
[List->InsertFrom]
[List->InsertLast]
[List->Intersection]
[List->Iterator]
[List->Join]
[List->Last]
[List->Remove]
[List->RemoveAll]
[List->RemoveFirst]
[List->RemoveLast]
[List->Reverse]
[List->ReverseIterator]
[List->Second]
[List->Size]
[List->Sort]
[List->SortWith]
[List->Union]
[Map->Contains]
[Map->Find]
[Map->Get]
[Map->Insert]
[Map->InsertFrom]
[Map->Iterator]
[Map->Keys]
[Map->Remove]
[Map->Removeall]
[Map->Size]
[Map->Values]
[Pair->First]
[Pair->Get]
[Pair->Name]
[Pair->Second]
[Pair->Size]
[Pair->Value]
[PriorityQueue->First]
[PriorityQueue->Get]
[PriorityQueue->Insert]
[PriorityQueue->InsertLast]
[PriorityQueue->Remove]
[PriorityQueue->RemoveFirst]
[PriorityQueue->Size]
[Queue->First]
[Queue->Get]
[Queue->Insert]
[Queue->InsertLast]
[Queue->Remove]
[Queue->RemoveFirst]
[Queue->Size]
[ReverseIterator->AtBegin]
[ReverseIterator->AtBottom]
[ReverseIterator->AtEnd]
[ReverseIterator->AtFarLeft]
[ReverseIterator->AtFarRight]
[ReverseIterator->AtTop]
[ReverseIterator->Backward]
[ReverseIterator->Down]
[ReverseIterator->Forward]
[ReverseIterator->InsertAtCurrent]
[ReverseIterator->Key]
[ReverseIterator->Left]
[ReverseIterator->RemoveCurrent]
[ReverseIterator->Reset]
[ReverseIterator->Right]
[ReverseIterator->Up]
[ReverseIterator->Value]
[Set->Contains]
[Set->Difference]
[Set->Find]
[Set->ForEach]
[Set->Get]
[Set->Insert]
[Set->InsertFrom]
[Set->Intersection]
[Set->Iterator]
[Set->Join]
[Set->Remove]
[Set->RemoveAll]
[Set->ReverseIterator]
[Set->Size]
[Set->Union]
[Stack->First]
[Stack->Get]
[Stack->Insert]
[Stack->InsertFirst]
[Stack->Remove]
[Stack->RemoveFirst]
[Stack->Size]
[TreeMap->Contains]
[TreeMap->Find]
[TreeMap->Get]
[TreeMap->Insert]
[TreeMap->Insertfrom]
[TreeMap->Iterator]
[TreeMap->Keys]
[TreeMap->Remove]
[TreeMap->RemoveAll]
[TreeMap->Size]
[TreeMap->Values]