removeLastWord method

String removeLastWord([
  1. int amount = 1
])

Implementation

String removeLastWord([int amount = 1]) {
  final int cacheLenght = length;
  if (cacheLenght > amount) {
    return substring(0, cacheLenght - amount);
  } else {
    return "";
  }
}