Prototype: string_length(data)

Return type: int

Description: Returns the byte length of data.

Arguments:

  • data: string, in the range: .*

Example:

body common control
{
      bundlesequence => { "example" };
}

bundle agent example
{
  vars:
      "length" int =>  string_length("abc"); # will contain "3"
  reports:
      "length of string abc = $(length)";
}

Output:

R: length of string abc = 3

History: Introduced in CFEngine 3.6

See also: string_head(), string_tail(), string_reverse().