使用 java.util.logging 打印不带空格的数字?
Print number without spaces using java.util.logging?
我目前正在使用 Vertx 的默认日志记录工具:java.utils.logging
。
我有一个定义如下的变量:private static int port = 8600;
这一行:
logger.info("Server is now listening on port {0}", port);
给出以下输出:
[2018-05-29 16:00:54] [INFOS ] Server is now listening on port 8 600
我发现 8 600
中的 space 令人不安,因为端口通常不写 spaces。
如何让我的记录器打印端口号为:8600
而不是 8 600
?
提前致谢。
尝试使用 {0,number,#}
而不是 {0}
。
编辑:更多信息:https://docs.oracle.com/javase/8/docs/api/java/text/MessageFormat.html
我目前正在使用 Vertx 的默认日志记录工具:java.utils.logging
。
我有一个定义如下的变量:private static int port = 8600;
这一行:
logger.info("Server is now listening on port {0}", port);
给出以下输出:
[2018-05-29 16:00:54] [INFOS ] Server is now listening on port 8 600
我发现 8 600
中的 space 令人不安,因为端口通常不写 spaces。
如何让我的记录器打印端口号为:8600
而不是 8 600
?
提前致谢。
尝试使用 {0,number,#}
而不是 {0}
。
编辑:更多信息:https://docs.oracle.com/javase/8/docs/api/java/text/MessageFormat.html