I'm trying out the example given at Oracle's documentations. The java file is here as shown in that page. Now with this java file, I keep a LabelsBundle.properties file in the same directory.
# This is the default LabelsBundle.properties file s1 = computer s2 = disk s3 = monitor s4 = keyboard it seems that the trailing whitespace is not ignored while reading the values and the leading whitespaces are ignored.
So if I want leading spaces to be there, what do I do?
In other words, what do I need to do to read the value of s1 as
computer instead of
computer ?
A Unicode escape sequence \u0020 should do it, because the properties parser should recognise it as an actual value and the Java String should interpret \u0020 as the Unicode code point for space.
Alternatively, IIRC, you can escape the space with a backslash like this \ my value. Works for keys, too.
You can escape space with backlash:
s1 =\ computer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With