STR_SPLIT

Script Function: Splits a string to several parts using a separator.

Syntax

STR_SPLIT (String, Delimiter)

Syntax

Description/Format

String

The string that should be split.
Format: script literal or script variable

Separator This can be any character of your choice.
Format: AE-Name, script literal or script variable

Return codes

Array that includes the individual partial strings.

This script function splits the specified String to several partial strings by using a certain Separator. The result is an array that stores the individual strings.

Note: The result does not include the separator.

To store the result, define a script array and fill it with values. Use the string data type when you define the array.

More Information:

Examples

The following example splits the string "123_456_789" as specified with the separator "_" and stores the result in a string array. The individual array elements are then written to the activation report.

:DEFINE &STRINGS#, string, 5
:SET &STRING#"123_456_789"
:FILL &STRINGS#[] = STR_SPLIT(&STRING#,"_")




:SET &VAR# = 1
:SET &LEN# = LENGTH(&STRINGS#[])

:WHILE &VAR# LE &LEN#
:SET &VAR#FORMAT(&VAR#,"0")
:PRINT "&VAR#. Partial string = &STRINGS#[&VAR#]"
:SET &VAR# = &VAR#+ 1
:ENDWHILE

Output in the activation report:

2013-10-23 10:30:48 - U0020408 1. Partial string = 123

2013-10-23 10:30:48 - U0020408 2. Partial string = 456

2013-10-23 10:30:48 - U0020408 3. Partial string = 789

2013-10-23 10:30:48 - U0020408 4. Partial string =

2013-10-23 10:30:48 - U0020408 5. Partial string =

See also:

seealso

Script Elements for Editing Strings