toCamelCase property
Returns the String
in Camel Case.
Example
String foo = 'Find max of array';
String camelCase = foo.toCamelCase; // returns 'findMaxOfArray'
Implementation
String get toCamelCase {
if (isBlank) {
return blankIfNull;
}
var words = trim().split(RegExp(r'(\s+)'));
var result = words[0].toLowerCase();
for (var i = 1; i < words.length; i++) {
result += "${words[i].substring(0, 1).toUpperCase()}${words[i].substring(1).toLowerCase()}";
}
return result;
}