AMT Help Files

String SPLIT

Syntax

Command
Mandatory parameter
Optional parameter
Mandatory keyword
Optional keyword

<Destination> := <Source>.SPLIT (<Delimiter>[, <RemoveEmpty>])

Description

Copies an alphanumeric variable in one or more parts separated by a delimiter and adds the parts to a list.

Diagram

Returned value type

List

Parameters

Parameter Description
<Destination> List variable into which the result values are added.
<Source> Alphanumeric variable from which the substrings are copied.
<Delimiter> A character or string which delimits the substrings.
<RemoveEmpty> An optional Boolean parameter to remove empty substrings from the resulting list when set to true.
The default value is false.

Remarks

The copied substring will always be handled according to the type of the specified <Destination> list. This means that if the <Destination> list is of the type string and the substring contains trailing spaces, these spaces will be omitted.

Examples


A
    str  := 'a,b,c,d,e,f'
    strlist := str.split (',')
    // The list will contain 6 elements, one for each letter.
    
B
    str  := 'Monday,,Wednesday,,Friday'
    strlist := str.split (',', true)
    // The list will contain 3 elements, one for each day.
    // Due to the 'RemoveEmpty' option set to true, the two empty substrings are removed.
    
C
    str  := 'Monday,Tuesday,Wednesday,Thursday,Friday,'
    strlist := str.split ('day,')
    // The list will contain 6 elements, 'Mon', 'Tues', 'Wednes', 'Thurs' , 'Fri' & ''.