Documentation for Script Function :STR_SPLIT missing multiple separators information

book

Article ID: 87908

calendar_today

Updated On:

Products

CA Automic Workload Automation - Automation Engine AUTOMIC WORKLOAD AUTOMATION

Issue/Introduction

Error Message :
N/A

Documentation for the Script Function :STR_SPLIT when using multiple separators is not clear.

Example
Using the function to split "A...B..C.D" using a . (dot) as the separator, the resulting array looks like:
&ARRAY#[1] = A
&ARRAY#[2] =
&ARRAY#[3] =
&ARRAY#[4] = B
&ARRAY#[5] =
&ARRAY#[6] = C
&ARRAY#[7] = D
&ARRAY#[8] =

For "...B....C" it looks like:

&ARRAY#[1] =
&ARRAY#[2] =
&ARRAY#[3] =
&ARRAY#[4] = B
&ARRAY#[5] =
&ARRAY#[6] =
&ARRAY#[7] =
&ARRAY#[8] = C

Unlike in other script languages, multiple separators are not treated as one and there is no option to enable them to be treated as one. Also, the documentation it is not clear as to what happens in case of leading or trailing separators.

In the fix versions below the following text has been added to the documentaiton for the STR_SPLIT script function.

When multiple separator characters are used in a row, the STR_SPLIT script function creates empty strings for the second separator and all subsequent separators.
When a string begins with one or more separator characters, the STR_SPLIT script function creates empty strings for them.

Reference

11.2 Documentation
Automation Engine Script Guide > Ordered by Function > Strings > STR_SPLIT
 

Cause

Cause type:
By design
Root Cause: Additional information about separator characters needed to be added to the documentation.

Environment

Release: AUTWAB99000-11.0-Automic Workload Automation-Base Edition
Component:

Resolution

This field was added on 30/03/2017. This article has not been updated yet. Refer to the "Description" or "Workaround" sections for solution information.

Fix Status: Released

Fix Version(s):
Component: Documentation

Automation Engine 11.2.2 - Available
Automation Engine 11.1.3 - Available
Automation Engine 10.0.8 – Available

Additional Information

Workaround :
Example for removing double entries using script::set &STRING# = STR_TRIM(&STRING#):set &wiederholung# = "J":WHILE &wiederholung# = "J": set &STRING# = STR_SUBSTITUTE(&STRING#, " ", " "): set &doppelblank# =STR_FIND(&STRING#," "): if &doppelblank# = 0: set &wiederholung# = "N": endif:ENDWHILE