Function cras::removePrefix

Function Documentation

::std::string cras::removePrefix(const ::std::string &str, const ::std::string &prefix, bool *hadPrefix = nullptr)

Remove prefix from start of str if it contains it, otherwise return str unchanged.

Parameters:
  • str[in] The string to work on.

  • prefix[in] The prefix to find.

  • hadPrefix[in] If non-null, will contain information whether str starts with prefix.

Returns:

If str starts with prefix, it will return str with prefix removed. Otherwise, str will be returned unchanged.