Eduardo Florence

Utils: capitalize cannot convert space to null

... ... @@ -518,17 +518,16 @@ class GetUtils {
/// Capitalize each word inside string
/// Example: your name => Your Name, your name => Your name
static String capitalize(String value) {
if (isNullOrBlank(value)) return null;
if (isNull(value)) return null;
if (isBlank(value)) return value;
return value.split(' ').map(capitalizeFirst).join(' ');
}
/// Uppercase first letter inside string and let the others lowercase
/// Example: your name => Your name
static String capitalizeFirst(String s) {
if (isNullOrBlank(s)) {
return null;
}
if (isNull(s)) return null;
if (isBlank(s)) return s;
return s[0].toUpperCase() + s.substring(1).toLowerCase();
}
... ...