MCPcopy Create free account
hub / github.com/ada-url/ada / string_view substring

Method string_view substring

include/ada/helpers.h:107–118  ·  view source on GitHub ↗

* @private * Return the substring from input going from index pos1 to the pos2 (non * included). The length of the substring is pos2 - pos1. */

Source from the content-addressed store, hash-verified

105 * included). The length of the substring is pos2 - pos1.
106 */
107ada_really_inline constexpr std::string_view substring(std::string_view input,
108 size_t pos1,
109 size_t pos2) {
110#if ADA_DEVELOPMENT_CHECKS
111 if (pos2 < pos1) {
112 std::cerr << "Negative-length substring: [" << pos1 << " to " << pos2 << ")"
113 << std::endl;
114 abort();
115 }
116#endif
117 return input.substr(pos1, pos2 - pos1);
118}
119
120/**
121 * @private

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected