Updated on 2023-12-13 GMT+08:00

split

Generally, the split function is used together with the select or get_list_length function. The split function is mainly used in the following scenarios:

  • A string is split into a group of strings so that specific elements can be easily obtained from the result string list.
  • A result string array is directly used.

Syntax

split: [delimiter, sourceString ]

Parameters

Table 1 Parameters

Parameter

Description

delimiter

Separator, which can be a string, single character, or variable obtained using the get_input function.

sourceString

Original string, which can be a variable obtained using the get_input function.

Original strings are grouped by separators.

Return Values

Split string arrays are returned.

Examples

The following describes how to use the split function to group strings:

inputs:
  source:
    default: "a,b,c,d,e,f,g"
node_templates: 
  test: 
    type: HuaweiCloud.AOS.Stack 
    properties: 
      templateId: "abcdf-fdeee" 
      inputs:
        aaa: {select: [0, {split: [",", {get_input: source}]}]}                 # The value is a.