This commit is contained in:
ImBenji
2024-05-01 19:28:51 +01:00
parent fc4d3ef898
commit c2ebac5bb5
30 changed files with 4727 additions and 403 deletions

View File

@@ -27,8 +27,8 @@ class NameBeautify {
stopName = stopName.replaceAll(RegExp(r'\>.*\<'), '');
// remove any special characters except & and /
stopName = stopName.replaceAll(RegExp(r'[^a-zA-Z0-9&/ ]'), '');
// remove any special characters except & and / and -
stopName = stopName.replaceAll(RegExp(r'[^a-zA-Z0-9&\/\- ]'), '');
// remove any double spaces
stopName = stopName.replaceAll(RegExp(r' '), ' ');
@@ -41,12 +41,17 @@ class NameBeautify {
stopName = stopName.replaceAll(RegExp(phrase, caseSensitive: false), Longify[phrase]!);
}
// remove any spaces at the start or end of the string
stopName = stopName.trim();
stopName = stopName.replaceAll(' ', ' ');
stopName = stopName.toLowerCase();
// Capitalify the first letter of each word
try {
stopName = stopName.split(' ').map((word) => word[0].toUpperCase() + word.substring(1)).join(' ');
} catch (e) {}
} catch (e) {
print("Error capitalifying stop name: $stopName");
}
return stopName;