-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcuteurl.cpp
48 lines (48 loc) · 1.07 KB
/
cuteurl.cpp
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
42
43
44
45
46
47
48
#include "cuteurl.h"
cuteurl::cuteurl()
{
}
bool cuteurl::is_url(QString url)
{
if(url.startsWith("http") or url.startsWith("https"))
{
return true;
}
if(url.startsWith("www"))
{
return true;
}
return false;
}
QString cuteurl::complete_url(QString url)
{
QString completeurl;
if(url.startsWith("www"))
{
completeurl = "http://" + url;
return completeurl;
}
return url;
}
QString cuteurl::encodedurl(QString query)
{
query.replace("!" , "%21");
query.replace("#" , "%23");
query.replace("$" , "%24");
query.replace("&" , "%26");
query.replace("'" , "%27");
query.replace("(" , "%28");
query.replace(")" , "%29");
query.replace("*" , "%2A");
query.replace("+" , "%2B");
query.replace("," , "%2C");
query.replace("/" , "%2F");
query.replace(":" , "%3A");
query.replace(";" , "%3B");
query.replace("=" , "%3D");
query.replace("?" , "%3F");
query.replace("@" , "%40");
query.replace("[" , "%5B");
query.replace("]" , "%5D");
return query;
}