Function cras::prependIfNonEmpty

Function Documentation

::std::string cras::prependIfNonEmpty(const ::std::string &str, const ::std::string &prefix)

If str is nonempty, returns prefix + str, otherwise empty string.

Parameters:
  • str[in] The main string.

  • prefix[in] The string’s prefix.

Returns:

The possibly prefixed string.