capitalisation property

String get capitalisation

Returns String as First letter capitalized.

final str = "hello";
str.capitalisation;  // Hello

Implementation

String get capitalisation {
  if (isBlanksOnly) return this;
  if (trim().length == 1) return toUpperCase();
  return trim().characters.first.toUpperCase() + substring(1);
}