string_head

Table of Contents

Prototype: string_head(data, max)

Return type: string

Description: Returns the first max bytes of data.

Arguments:

  • data: string, in the range: .*
  • max: int, in the range: 0,99999999999

Example:

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

bundle agent example
{
  vars:
      "start" string => string_head("abc", "1"); # will contain "a"
  reports:
      "start of abc = $(start)";

}

Output:

R: start of abc = a

History: Introduced in CFEngine 3.6

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