From: Damyan Ivanov Date: Sat, 15 Dec 2018 19:35:33 +0000 (+0000) Subject: helper method fot getting the short account name X-Git-Tag: v0.3~227 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=ccedc0d34a6846d9458ac0ccfa8028df7cecc87a;p=mobile-ledger.git helper method fot getting the short account name assets:cash:Peter becomes a:c:Peter --- diff --git a/app/src/main/java/net/ktnx/mobileledger/model/LedgerTransactionItem.java b/app/src/main/java/net/ktnx/mobileledger/model/LedgerTransactionItem.java index ff19a450..33347060 100644 --- a/app/src/main/java/net/ktnx/mobileledger/model/LedgerTransactionItem.java +++ b/app/src/main/java/net/ktnx/mobileledger/model/LedgerTransactionItem.java @@ -40,6 +40,11 @@ public class LedgerTransactionItem { public String getAccountName() { return accountName; } + public String getShortAccountName() { + String result = accountName; + result = result.replaceAll("(?<=^|:)(.)[^:]+(?=:)", "$1"); + return result; + } public void setAccountName(String accountName) { this.accountName = accountName;