mirror of
https://github.com/krawieck/lemmur/
synced 2024-12-16 02:19:06 +01:00
17 lines
385 B
Dart
17 lines
385 B
Dart
/// Strips protocol, 'www.', and trailing '/' from [url] aka. cleans it up
|
|
String cleanUpUrl(String url) {
|
|
var newUrl = 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;
|
|
}
|