firstChars method

String firstChars(
  1. int n
)

Implementation

String firstChars(int n) {
  if (n <= 0) return "";
  if (n >= length) return this;
  return substring(0, n + 1);
}