summaryrefslogtreecommitdiff
path: root/icespider/core/util.cpp
blob: 62de1951c98c611967014645468954cdaba2e21c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "util.h"

namespace IceSpider {
	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);
		}
	}
}