I have a problem using the String.format() method.
So I want to create a String with a line feed, for which I use %n.
I create the string like this:
for (int i = 0; i < authorNames.size(); i++) {
tmpReturnString += authorNames.get(i) + "%n";
}
with authorNames beeing a ArrayList.
Next I want to return the formatted String:
returnResult.setAttributes(0, String.format(tmpReturnString.substring(0, tmpReturnString.length() - 1)))
returnResult is going to be my return.
But here I get a java.util.UnknownFormatConversionException: Conversion = '%'.
Unfortunatly I have no clue how to fix this issue. Also, non of the other questions helped me.
Thanks in advance!
\n, try it ;)substringoperation removes thenfrom the end. Why would you do that?