string_tail
Table of contents
Prototype: string_tail(data, max)
Return type: string
Description: Returns the last max
bytes of data
.
If max
is negative, then everything but the first max
bytes is returned.
Arguments:
data
:string
- Input string - in the range:.*
max
:int
- Maximum number of characters to return - in the range:-99999999999,99999999999
Example:
code
body common control
{
bundlesequence => { "example" };
}
bundle agent example
{
vars:
"end" string => string_tail("abc", "1"); # will contain "c"
reports:
"end of abc = $(end)";
}
Output:
code
R: end of abc = c
History: Introduced in CFEngine 3.6
See also: string_head()
, string_length()
, string_reverse()
.