String.split(seperator) Last updated: 13. Nov 2023

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

Parameters

Name Type Description
seperator string Seperator text to split string by.

Returns

An array of string.

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>