String.split(separator) Last updated: 30. May 2026

Splits a single string into an array of strings based on the specified separator.

Parameters

Name Type Description
separator string

Separator text to split the string by.

Returns

An array of strings.

Example

Code example (#JS)

#JS is mixed HTML (or other text file) with inline JavaScript with # starting and ending each inline statement.
#{
    var text = "1,2,3,4,5,6,7";
    
    /* Split text by comma */
    var array = text.split(",");
    
    for(let item of array)
    {
}#
<div>#item#</div>        
#}#

Output

The #JS code above produces the output shown below:
<div>1</div>        
<div>2</div>        
<div>3</div>        
<div>4</div>        
<div>5</div>        
<div>6</div>        
<div>7</div>