1
0
mirror of https://github.com/krawieck/lemmur/ synced 2024-12-16 10:30:24 +01:00
lemmur-app-android/lib/util/cleanup_url.dart
2020-10-06 16:22:49 +02:00

15 lines
331 B
Dart

/// Strips protocol, 'www.', and trailing '/' from [url] aka. cleans it up
String cleanUpUrl(String url) {
if (url.startsWith('https://')) {
url = url.substring(8);
}
if (url.startsWith('www.')) {
url = url.substring(4);
}
if (url.endsWith('/')) {
url = url.substring(0, url.length - 1);
}
return url;
}