List Function
This section describes list functions, including their syntax, parameters, and usage examples.
Function List
Function |
Description |
---|---|
Creates a list. |
|
Inserts elements at a specific position in the list. |
|
Adds elements to the end of the list. |
|
Deletes elements from a specific position in the list. |
|
Reverses sorting list. |
|
Obtains an element in a list or tuple. |
lst_make
Use the lst_make function to create a list.
- Function format
lst_make(value1, value2, ...)
- Parameter description
Parameter
Type
Mandatory
Description
value1
String
Yes
Element of the list.
value2
String
Yes
Element of the list.
- Returned result
Created list.
- Function example
- Test data
{ "content":"test" }
- Processing rule
e_set("hello", lst_make("k1","k2"))
- Processing result
content:test hello:["k1", "k2"]
- Test data
lst_insert
Use the lst_insert function to insert elements at a specific position in the list.
- Function format
lst_insert(list_string, location, value1, value2, ...)
- Parameter description
Parameter
Type
Mandatory
Description
list_string
List
Yes
List to be operated.
location
Number
Yes
Position to be inserted.
value1
String
Yes
Element to be inserted.
value2
String
No
Element to be inserted.
- Returned result
List after the element is inserted.
- Function example
- Test data
{ "ctx": ["k1","k2"] }
- Processing rule
e_set("hello", lst_insert(v("ctx"), 0, "k0"))
- Processing result
ctx: ["k1","k2"] hello: ["k0", "k1", "k2"]
- Test data
lst_append
Use the lst_append function to add elements to the end of the list.
- Function format
lst_append(list_string, value1, value2, ...)
- Parameter description
Parameter
Type
Mandatory
Description
list_string
List
Yes
List to be operated.
value1
String
Yes
Element to be appended.
value2
String
No
Element to be appended.
- Returned result
List after the element is appended.
- Function example
- Test data
{ "ctx": [ "k1", "k2" ] }
- Processing rule
e_set("hello", lst_append(v("ctx"), "k3"))
- Processing result
ctx: ["k1","k2"] hello: ["k1", "k2", "k3"]
- Test data
lst_delete_at
Use the lst_delete_at function to return the list after the element is deleted.
- Function format
lst_delete_at(list_string, location)
- Parameter description
Parameter
Type
Mandatory
Description
list_string
list
Yes
List to be operated.
location
Number
Yes
Position of the element to be deleted. The first element starts from position 0.
- Returned result
List of dictionary keys.
- Function example
- Test data
{ "ctx": ["k1","k2"] }
- Processing rule
e_set("hello", lst_delete_at(v("ctx"),1))
- Processing result
ctx: ["k1","k2"] hello: ["k1"]
- Test data
lst_reverse
Use the lst_reverse function to reverse the sorting list.
- Function format
lst_reverse(list_string)
- Parameter description
Parameter
Type
Mandatory
Description
list_string
List
Yes
List to be operated.
- Returned result
Reversed list.
- Function example
- Test data
{ "ctx":["v1","v2"] }
- Processing rule
e_set("hello", lst_reverse(v("ctx")))
- Processing result
ctx: ["v1","v2"] hello: ["v2","v1"]
- Test data
lst_get
Use the lst_get function to obtain an element in a list or tuple.
- Function format
lst_get(list_string, location)
- Parameter description
Parameter
Type
Mandatory
Description
ist_string
List
Yes
List to be operated.
location
Int
Yes
The number is counted from 0. For example, if the data is ["a","b","c"], the obtained element positions are 0, 1, and 2.
- Returned result
One of the elements in the list.
- Function example
- Test data
{ "ctx":["v1","v2"] }
- Processing rule
e_set("hello", lst_get(v("ctx"),1))
- Processing result
ctx: ["v1","v2"] hello: "v2"
- Test data
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot