removeLastCharacters function

String removeLastCharacters(
  1. String text,
  2. int count
)

Convenience method to remove a given number of characters from the end of a string

Implementation

String removeLastCharacters(String text, int count) {
  if (text.length < count) return "";
  return text.substring(0, text.length - count);
}