toUpperCaseInitials function
Formats s
with initial character to Upper case.
Implementation
String toUpperCaseInitials(String s) {
if (s.isEmpty) return s;
return s.toLowerCase().replaceAllMapped(RegExp(r'(\s|^)(\S)'), (m) {
var m1 = m[1]!;
var m2 = m[2]!;
return '$m1${m2.toUpperCase()}';
});
}