Back to Home
$joinSplitText
$joinSplitText joins all current split elements back into a
single string using a separator you specify. You can use the same
separator as the original split, or a completely different one.
Syntax
$joinSplitText[Separator]
-
Separator: the string to place between each element. Can be empty to join without any separator.
What happens
-
$textSplitcreates the split and stores the elements. -
$joinSplitTexttakes all elements in their current order and combines them into one string, placing the separator between each pair. - The combined string is returned.
If elements have been removed or edited since
$textSplit was called,
$joinSplitText reflects those changes.
Example 1: Rejoin with a different separator
$nomention
$textSplit[hello#world#!;#]
$joinSplitText[ ]
What happens:
-
$textSplitsplits the string intohello,world,!. -
$joinSplitText[ ]rejoins them using a space instead of#.
Output:
hello world !
Example 2: Rejoin after removing an element
$nomention
$textSplit[hello-world-!;-]
$removeSplitTextElement[3]
$joinSplitText[-]
What happens:
-
$textSplitcreates three elements:hello,world,!. -
$removeSplitTextElement[3]removes!. -
$joinSplitText[-]reassembles the remaining two elements.
Output:
hello-world
Common uses
- Rebuilding a string after editing or removing elements
- Changing the separator of an existing split
- Displaying all elements at once with a custom separator (e.g. newlines)
See also
- $textSplit: must be called first to create the split
- $removeSplitTextElement: to remove an element before joining
- $editSplitText: to replace an element before joining