Table of Contents
length
Table of Contents
Prototype: length(list)
Return type: int
Description: Returns the length of list
.
Arguments:
list
:string
, in the range:[a-zA-Z0-9_$(){}\[\].:]+
Example:
body common control
{
bundlesequence => { "test" };
}
bundle agent test
{
vars:
"test" slist => {
1,2,3,
"one", "two", "three",
"long string",
"four", "fix", "six",
"one", "two", "three",
};
"length" int => length("test");
"test_str" string => join(",", "test");
reports:
"The test list is $(test_str)";
"The test list has $(length) elements";
}
Output:
R: The test list is 1,2,3,one,two,three,long string,four,fix,six,one,two,three
R: The test list has 13 elements
See also: nth()
.