I am writing a function to capitalize the first letter of each line of a string. So the following input:
String test="this is a test" + System.lineSeparator() +
"write some words" + System.lineSeparator() +
"and sentences";
output should be:
String expected="This is a test" + System.lineSeparator() +
"Write some words" + System.lineSeparator()+
"And sentences";
However, when I run with Eclipse. The output is:
This is a test[
Write some words]
And sentences
Its byte:
54686973206973206120746573740a577269746520736f6d6520776f726473416e642073656e74656e636573
The expected string in Eclipse is:
This is a test[
Write some words
]
And sentences
Its byte:
54686973206973206120746573740d0a577269746520736f6d6520776f7264730d0a416e642073656e74656e636573
So two strings are not equal. I run some code in an online Java compiler, two strings are equal.
I am wondering if any specific system command should be set to accomodate with lineSeparator() and make two Strings (output and expected) be equal?
Thanks;