get all characters from string before last n characters.
String allBeforeLastN(int n) => substring(0, length - n);