util/UriExtract: add uri_get_fragment()
This commit is contained in:
parent
9c6850210d
commit
e4612ecb66
@ -138,3 +138,13 @@ uri_get_suffix(const char *uri, UriSuffixBuffer &buffer) noexcept
|
|||||||
|
|
||||||
return suffix;
|
return suffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
uri_get_fragment(const char *uri) noexcept
|
||||||
|
{
|
||||||
|
const char *fragment = strchr(uri, '#');
|
||||||
|
if (fragment == nullptr)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
return fragment + 1;
|
||||||
|
}
|
||||||
|
@ -72,4 +72,14 @@ gcc_pure
|
|||||||
const char *
|
const char *
|
||||||
uri_get_suffix(const char *uri, UriSuffixBuffer &buffer) noexcept;
|
uri_get_suffix(const char *uri, UriSuffixBuffer &buffer) noexcept;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the URI fragment, i.e. the portion after the '#', but
|
||||||
|
* without the '#'. If there is no '#', this function returns
|
||||||
|
* nullptr; if there is a '#' but no fragment text, it returns an
|
||||||
|
* empty StringView.
|
||||||
|
*/
|
||||||
|
gcc_pure gcc_nonnull_all
|
||||||
|
const char *
|
||||||
|
uri_get_fragment(const char *uri) noexcept;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user