removeFirst method

String removeFirst(
  1. int n
)

Removes the first n characters from the String.

Example

String foo = 'esentis'
String newFoo = foo.removeFirst(3) // 'ntis';

Implementation

String removeFirst(int n) {
  if (this.isBlank) {
    return this;
  }

  if (n <= 0) {
    return this;
  }
  if (n >= this.length) {
    return '';
  }
  return this.substring(n, this.length);
}