From ccedc0d34a6846d9458ac0ccfa8028df7cecc87a Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Sat, 15 Dec 2018 19:35:33 +0000 Subject: [PATCH] helper method fot getting the short account name assets:cash:Peter becomes a:c:Peter --- .../net/ktnx/mobileledger/model/LedgerTransactionItem.java | 5 +++++ 1 file changed, 5 insertions(+) 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; -- 2.39.5