util/StringUtil: add StringAfterPrefix()

This commit is contained in:
Max Kellermann
2015-10-16 19:15:30 +02:00
parent 85f58eb082
commit 607c2c5ba2
4 changed files with 49 additions and 0 deletions

View File

@@ -36,6 +36,15 @@ gcc_pure
bool
StringEndsWith(const char *haystack, const char *needle);
/**
* Returns the portion of the string after a prefix. If the string
* does not begin with the specified prefix, this function returns
* nullptr.
*/
gcc_pure gcc_nonnull_all
const char *
StringAfterPrefix(const char *string, const char *prefix);
/**
* Check if the given string ends with the specified suffix. If yes,
* returns the position of the suffix, and nullptr otherwise.