java 如何在属性值末尾添加空格

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6235283/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 14:57:36  来源:igfitidea点击:

How to add space at the end of property value

javaresourcebundle

提问by Joe

label.my.answer=My Answer

I would like to add spaces deliberately at the end of the above key (e.g. I would like to have 2 spaces at the end "My Answer ")

我想在上述键的末尾故意添加空格(例如,我想在末尾有 2 个空格"My Answer "

Currently the java.util.ResourceBundle functionality kind of trims this piece of code while retrieving the value

当前 java.util.ResourceBundle 功能在检索值时会修剪这段代码

回答by Roland Illig

label.myAnswer = My Answer\u0020\u0020

Note: identifiers with dots usually represent a hierarchy of names, and myis not a hierarchy level. You would certainly not define a Java class or a Java package of that name, would you?

注意:带有点的标识符通常表示名称的层次结构,而my不是层次结构级别。您肯定不会定义同名的 Java 类或 Java 包,对吗?

回答by Barett

Also

label.myAnswer = My Answer\ \