static String getLastChar(String str) { if (str.isEmpty) { return ''; } return str.substring(str.length - 1); }