implemented new comments
This commit is contained in:
parent
0aa4d9c592
commit
725f9103d6
|
@ -1,19 +1,7 @@
|
||||||
/// Strips protocol, 'www.', and trailing '/' from [url] aka. cleans it up
|
/// Returns host of a url without a leading 'www.' or protocol if present also
|
||||||
String cleanUpUrl(String url) {
|
/// removes trailing '/'
|
||||||
var newUrl = url.toLowerCase();
|
String cleanUpUrl(String url) =>
|
||||||
|
urlHost(url.startsWith('https://') ? url : 'https://$url');
|
||||||
if (newUrl.startsWith('https://')) {
|
|
||||||
newUrl = newUrl.substring(8);
|
|
||||||
}
|
|
||||||
if (newUrl.startsWith('www.')) {
|
|
||||||
newUrl = newUrl.substring(4);
|
|
||||||
}
|
|
||||||
if (newUrl.endsWith('/')) {
|
|
||||||
newUrl = newUrl.substring(0, newUrl.length - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return newUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns host of a url without a leading 'www.' if present
|
// Returns host of a url without a leading 'www.' if present
|
||||||
String urlHost(String url) {
|
String urlHost(String url) {
|
||||||
|
|
Loading…
Reference in New Issue