diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-06-24 21:19:35 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-06-24 21:19:35 +0200 |
commit | 994d59fec563992e14d807acc4342394e44b8659 (patch) | |
tree | b970154e32b35c5de9aa1972ed5b76450b08b38b /src/main/java/de/pixart/messenger | |
parent | 7adb0ca6b889aac5f306d2e0efdda277d6ae614b (diff) |
cleanup nameWithoutVersion() code
Diffstat (limited to 'src/main/java/de/pixart/messenger')
-rw-r--r-- | src/main/java/de/pixart/messenger/entities/Presences.java | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/Presences.java b/src/main/java/de/pixart/messenger/entities/Presences.java index c82e733e9..273a754e1 100644 --- a/src/main/java/de/pixart/messenger/entities/Presences.java +++ b/src/main/java/de/pixart/messenger/entities/Presences.java @@ -149,21 +149,17 @@ public class Presences { private static String nameWithoutVersion(String name) { String[] parts = name.split(" "); - if (parts.length <= 1) { - return name; - } else { - if (Character.isDigit(parts[parts.length - 1].charAt(0))) { - StringBuilder output = new StringBuilder(); - for (int i = 0; i < parts.length - 1; ++i) { - if (output.length() != 0) { - output.append(' '); - } - output.append(parts[i]); + if (parts.length > 1 && Character.isDigit(parts[parts.length - 1].charAt(0))) { + StringBuilder output = new StringBuilder(); + for (int i = 0; i < parts.length - 1; ++i) { + if (output.length() != 0) { + output.append(' '); } - return output.toString(); - } else { - return name; + output.append(parts[i]); } + return output.toString(); + } else { + return name; } } } |