Joining and splitting strings Last updated: 22. Dec 2022

How to join text strings into one and split back to many strings.

Example

Code Join and split.hash

<h1>Some HTML file</h1>
#{

var text = "hello";
var text2 = "world";

/* Output hello world */
var joined = text + " " + text2;
write(joined);


/* Write a new line */
write(chr(13));


/* Split the string */
var parts = joined.split(" ");

/* Output the first (0-indexed) word only */
write(parts[0]); // 


}#

Output

<h1>Some HTML file</h1>
hello world
hello