mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 17:47:28 +00:00
Bug fixes
This commit is contained in:
@ -63,9 +63,16 @@ class StringHelpers {
|
||||
}
|
||||
|
||||
static String toTitleCase(String text) {
|
||||
return text
|
||||
.split(' ')
|
||||
.map((word) => word[0].toUpperCase() + word.substring(1))
|
||||
.join(' ');
|
||||
if (text.contains(' ')) {
|
||||
//remove empty elements
|
||||
String title = text.split(' ').where((element) => element.isNotEmpty).join(' ');
|
||||
String result = title
|
||||
.split(' ')
|
||||
.map((element) => element[0].toUpperCase() + element.substring(1))
|
||||
.join(' ');
|
||||
return result;
|
||||
} else {
|
||||
return text.toUpperCase();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user