-
Notifications
You must be signed in to change notification settings - Fork 5
/
url.m
41 lines (41 loc) · 945 Bytes
/
url.m
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
classdef url
properties(Constant)
type_list={...
'http','https','ftp','scp'
};
type_set='://';
end
methods(Static)
function test
u='http://domain.something.edu/dir1/page.html';
disp(' - u -')
disp(u)
disp(' - url.type(u) -')
disp(url.type(u))
disp(' - url.isurl(u) -')
disp(url.is(u))
disp(' - url.address(u) -')
disp(url.address(u))
end
function out=type(in)
out=strsplit(in,url.type_set);
out=out{1};
end
function out=is(in)
out=any(contains(url.type_list,url.type(in)));
end
function out=is_web(in)
out=any(contains({'http','https'},url.type(in)));
end
function out=is_ftp(in)
out=any(contains({'ftp'},url.type(in)));
end
function out=is_scp(in)
out=any(contains({'scp'},url.type(in)));
end
function out=address(in)
out=strsplit(in,url.type_set);
out=out{2};
end
end
end