Function cras::removeSuffix

Function Documentation

::std::string cras::removeSuffix(const ::std::string &str, const ::std::string &suffix, bool *hadSuffix = nullptr)

Remove suffix from end of str if it contains it, otherwise return str unchanged.

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

  • suffix[in] The suffix to find.

  • hadSuffix[in] If non-null, will contain information whether str ends with suffix.

Returns:

If str ends with suffix, it will return str with suffix removed. Otherwise, str will be returned unchanged.