Merge categories into one file, add some new ones
This commit is contained in:
@@ -3,7 +3,7 @@ package entities;
|
||||
public class Categories {
|
||||
|
||||
public enum ExpenseCategory {
|
||||
MISC;
|
||||
CREDIT, BUY, BUSINESS, ENTERTAINMENT, RESTAURANTS_AND_CAFE, COMMUNAL_PAYMENTS, SUPERMARKET, MISC;
|
||||
|
||||
public String getEffectiveName() {
|
||||
return Categories.getEffectiveName(this.name());
|
||||
@@ -11,7 +11,7 @@ public class Categories {
|
||||
}
|
||||
|
||||
public enum IncomeCategory {
|
||||
MISC;
|
||||
P2P, SALARY, GIFT, CREDIT, MISC;
|
||||
|
||||
public String getEffectiveName() {
|
||||
return Categories.getEffectiveName(this.name());
|
||||
@@ -19,9 +19,14 @@ public class Categories {
|
||||
}
|
||||
|
||||
private static String getEffectiveName(String name) {
|
||||
String[] arr = name.split("");
|
||||
StringBuilder result = new StringBuilder(arr[0].toLowerCase());
|
||||
for(int i = 1; i < name.length(); i++) result.append(arr[i]);
|
||||
String[] arr = name.split("_");
|
||||
StringBuilder result = new StringBuilder();
|
||||
for(String entry : arr) {
|
||||
String[] entryArr = entry.split("");
|
||||
StringBuilder builder = new StringBuilder(entryArr[0]);
|
||||
for(int i = 1; i < entry.length(); i++) builder.append(entryArr[i].toLowerCase());
|
||||
result.append(builder).append(" ");
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user