cleanString method
Implementation
String cleanString(String input) {
// Trim spaces from the start and end of the string
String trimmed = input.trim();
// Remove the "$" at the end if it exists
if (trimmed.endsWith('\$')) {
trimmed = trimmed.substring(0, trimmed.length - 1);
}
return trimmed.trim();
}