Browse Source

Switch to Guava String padding in ServerNumeric

pull/553/head
Greg Holmes 9 years ago
parent
commit
fa3dabee4f
1 changed files with 3 additions and 9 deletions
  1. 3
    9
      src/com/dmdirc/ServerEventHandler.java

+ 3
- 9
src/com/dmdirc/ServerEventHandler.java View File

@@ -96,6 +96,8 @@ import com.dmdirc.parser.interfaces.callbacks.WalluserListener;
96 96
 import com.dmdirc.ui.StatusMessage;
97 97
 import com.dmdirc.util.EventUtils;
98 98
 
99
+import com.google.common.base.Strings;
100
+
99 101
 import java.util.Date;
100 102
 import java.util.List;
101 103
 import java.util.Optional;
@@ -280,15 +282,7 @@ public class ServerEventHandler extends EventHandler implements
280 282
             final String[] token) {
281 283
         checkParser(parser);
282 284
 
283
-        String snumeric = String.valueOf(numeric);
284
-
285
-        if (numeric < 10) {
286
-            snumeric = "00" + snumeric;
287
-        } else if (numeric < 100) {
288
-            snumeric = '0' + snumeric;
289
-        }
290
-
291
-        final String sansIrcd = "numeric_" + snumeric;
285
+        final String sansIrcd = "numeric_" + Strings.padStart(String.valueOf(numeric), 3, '0');
292 286
         String target = "";
293 287
 
294 288
         if (owner.getConfigManager().hasOptionString("formatter", sansIrcd)) {

Loading…
Cancel
Save