From 9830c106d2d47c827d17ed9453e1591d8e5bd64d Mon Sep 17 00:00:00 2001 From: bezloginu Date: Thu, 22 Jun 2017 17:29:56 +0200 Subject: [PATCH] Trim contact name --- app/src/main/java/com/f1x/mtcdialer/PhoneBookActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/f1x/mtcdialer/PhoneBookActivity.java b/app/src/main/java/com/f1x/mtcdialer/PhoneBookActivity.java index 79c8243..2ca37ca 100644 --- a/app/src/main/java/com/f1x/mtcdialer/PhoneBookActivity.java +++ b/app/src/main/java/com/f1x/mtcdialer/PhoneBookActivity.java @@ -48,7 +48,7 @@ protected void onServiceConnected() { private void buildPhoneBook(List phoneBookRecords) { for(String phoneBookRecord : phoneBookRecords) { String[] parsedRecord = phoneBookRecord.split("\\^"); - String contactName = parsedRecord[0].replaceAll("\\s+", " ").replaceAll("\\s+$", ""); + String contactName = parsedRecord[0].trim().replaceAll(" +", " "); String phoneNumber = parsedRecord[1].replaceAll("[^\\d\\+]", ""); mPhoneBookRecords.put(contactName, phoneNumber);