Fix invalid charge error when using suffix currency on signs (#3253)

i swear i test my code

Fixes #3252.
This commit is contained in:
Josh Roy 2020-05-11 10:20:00 -04:00 committed by GitHub
parent fc2b7b63a2
commit 61d0ed3f01
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 10 deletions

View file

@ -88,6 +88,15 @@ public class NumberUtil {
return sign + tl("currency", ess.getSettings().getCurrencySymbol(), currency);
}
public static String sanitizeCurrencyString(final String input, final IEssentials ess) {
String symbol = ess.getSettings().getCurrencySymbol();
boolean suffix = ess.getSettings().isCurrencySymbolSuffixed();
if (input.contains(symbol)) {
return suffix ? input.substring(0, input.indexOf(symbol)) : input.substring(symbol.length());
}
return input;
}
public static boolean isInt(final String sInt) {
try {
Integer.parseInt(sInt);