capitalize method
capitalizes a given string 'hello' => 'Hello' 'Hello' => 'Hello' '' => ''
Implementation
String capitalize() {
if (this.isEmpty) return '';
return "${this[0].toUpperCase()}${this.substring(1).toLowerCase()}";
}
capitalizes a given string 'hello' => 'Hello' 'Hello' => 'Hello' '' => ''
String capitalize() {
if (this.isEmpty) return '';
return "${this[0].toUpperCase()}${this.substring(1).toLowerCase()}";
}