Identifier.create

Parse a string and returns the corresponding Identifier

If the string passed is not a valid identifier, this function will return the reason why, else it returns null.

This function is useful to get an identifier out of Collectd, or from any Collectd-formatted identifier. To construct an identifier with known values, initializing the fields is enough.

  1. Identifier create(cstring line)
  2. istring create(cstring line, Identifier identifier)
    struct Identifier

Parameters

line cstring

An string matching 'host/plugin-instance/type-instance'. Both instance part are optionals, in which case the '-' should be omitted.

identifier Identifier

An identifier to fill with the parsed string. If this function returns non-null, the state of identifier should not be relied upon.

Return Value

Type: istring

null if the parsing succeeded, else a string representing the error.

Meta