removeLast method

String removeLast([
  1. int upto = 1
])

Removes the last upto characters from the string.

@param upto The number of characters to remove from the end. Defaults to 1. @return The string with the last upto characters removed, or an empty string if the result would be empty.

Implementation

String removeLast([int upto = 1]) =>
    minLen(2) ? substring(0, length - upto) : '';