mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2026-01-13 21:59:32 +00:00
Some checks are pending
Flutter CI & Release / Test (push) Waiting to run
Flutter CI & Release / Build Android APKs (push) Blocked by required conditions
Flutter CI & Release / build_linux (push) Blocked by required conditions
Flutter CI & Release / Create GitHub Release (push) Blocked by required conditions
22 lines
599 B
Dart
22 lines
599 B
Dart
extension TitleCase on Enum {
|
|
String get properName {
|
|
final name = toString().split('.').last;
|
|
return name[0].toUpperCase() + name.substring(1);
|
|
}
|
|
|
|
String get titleCase {
|
|
return name
|
|
.replaceAllMapped(RegExp(r'([A-Z])'), (match) => ' ${match.group(0)}')
|
|
.trim();
|
|
}
|
|
|
|
String get pascalCase {
|
|
// capitalize the first letter of each word
|
|
return name
|
|
.replaceAllMapped(RegExp(r'([A-Z])'), (match) => ' ${match.group(0)}')
|
|
.trim()
|
|
.split(' ')
|
|
.map((word) => word[0].toUpperCase() + word.substring(1))
|
|
.join(' ');
|
|
}
|
|
}
|