aboutsummaryrefslogtreecommitdiff
path: root/url.ha
blob: 7162dd8fe691a3fc89b1610cfb7ef28945a6e186 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
use strings;
use net::uri;

// The result must be freed with strings::freeall;
fn segments_from_path(s: str) ([]str | nomem | net::uri::invalid) = {
	let sp: []str = strings::split(s, "/")?;
	for (let i = 1z; i < len(sp); i += 1)
		sp[i - 1] = net::uri::percent_decode(sp[i])?;
	return sp[.. len(sp) - 1];
};