removeFirst method

String removeFirst(
  1. int count
)

Removes the first count characters from the string.

Returns an empty string if count equals or exceeds the string length.

Example:

'hello'.removeFirst(2)  // 'llo'
'hi'.removeFirst(5)     // ''
'abc'.removeFirst(0)    // 'abc'

Implementation

String removeFirst(int count) {
  if (count < 0) { return this; }
  if (count > length) { return ''; }
  return substring(count);
}