capitalize property

String? capitalize

Converts the first character of string to upper case and the remaining to lower case.

'justkawal'.capitalize; // Justkawal
'JUSTKAWAL'.capitalize; // Justkawal

Implementation

String? get capitalize {
  String? result;
  if (isNotEmpty) {
    result = this[0].toUpperCase();
    if (length > 1) {
      result += substring(1).toLowerCase();
    }
  }
  return result;
}