Fixed text for costs starting with "and"

This commit is contained in:
Daniel Bomar 2021-01-20 09:47:54 -06:00
parent 91003b79dd
commit be23f19a32
No known key found for this signature in database
GPG key ID: C86C8658F4023918

View file

@ -51,9 +51,17 @@ public class CostsImpl<T extends Cost> extends ArrayList<T> implements Costs<T>
for (T cost : this) {
String textCost = cost.getText();
if (textCost != null && !textCost.isEmpty()) {
if (textCost.startsWith("and")) {
if (sbText.length() > 1) {
// Remove "," from previous cost
sbText.deleteCharAt(sbText.length() - 2);
}
sbText.append(textCost).append(", ");
} else {
sbText.append(Character.toUpperCase(textCost.charAt(0))).append(textCost.substring(1)).append(", ");
}
}
}
if (sbText.length() > 1) {
sbText.setLength(sbText.length() - 2);
}