Created by: Joshix-1
String#replaceAll uses RegEx. In RegEx the $ matches the end.
So name.replaceAll("$", "");
doesn't remove the dollar sign instead it does nothing.
The correct way to do it would be to use String#replace
which doesn't treat the first argument as RegEx.