From bef7412e0bd6d60cdad415fbd0e95a9cd1e79c5e Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Thu, 7 Sep 2023 20:16:59 +0700 Subject: [PATCH] decimal format --- .../chayapak/chomens_bot/commands/UrbanCommand.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/UrbanCommand.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/UrbanCommand.java index 27b389a9..dc46ccb7 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/UrbanCommand.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/UrbanCommand.java @@ -22,6 +22,7 @@ import net.kyori.adventure.text.format.TextDecoration; import java.net.URL; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; +import java.text.DecimalFormat; import java.util.concurrent.TimeUnit; public class UrbanCommand extends Command { @@ -78,9 +79,11 @@ public class UrbanCommand extends Command { final String word = definitionObject.get("word").getAsString(); final String _definition = definitionObject.get("definition").getAsString(); + final DecimalFormat formatter = new DecimalFormat("#,###"); + final String author = definitionObject.get("author").getAsString(); - final int thumbsUp = definitionObject.get("thumbs_up").getAsInt(); - final int thumbsDown = definitionObject.get("thumbs_down").getAsInt(); + final String thumbsUp = formatter.format(definitionObject.get("thumbs_up").getAsInt()); + final String thumbsDown = formatter.format(definitionObject.get("thumbs_down").getAsInt()); final String example = definitionObject.get("example").getAsString(); // whats the best way to implement this?