summaryrefslogtreecommitdiff
path: root/icespider/core/util.cpp
blob: b330f7934798268f92b9bcb052243b3ab4c6323a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "util.h"
#include "exceptions.h"

namespace IceSpider {
	void
	conversion_failure()
	{
		throw Http400_BadRequest();
	}

	void
	remove_trailing(std::string_view & in, const char c)
	{
		if (const auto n = in.find_last_not_of(c); n != std::string_view::npos) {
			in.remove_suffix(in.length() - n - 1);
		}
	}

	void
	remove_leading(std::string_view & in, const char c)
	{
		if (const auto n = in.find_first_not_of(c); n != std::string_view::npos) {
			in.remove_prefix(n);
		}
	}
}