implemented new comments

This commit is contained in:
ryg-git 2021-04-01 00:46:23 +05:30
parent 0aa4d9c592
commit 725f9103d6
1 changed files with 4 additions and 16 deletions

View File

@ -1,19 +1,7 @@
/// Strips protocol, 'www.', and trailing '/' from [url] aka. cleans it up
String cleanUpUrl(String url) {
var newUrl = url.toLowerCase();
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.' or protocol if present also
/// removes trailing '/'
String cleanUpUrl(String url) =>
urlHost(url.startsWith('https://') ? url : 'https://$url');
// Returns host of a url without a leading 'www.' if present
String urlHost(String url) {