java - How to add a LineBreak (\n) to a String.format with fixed String as format? -


in code below, message final string have \n inside it, , doesn't work.

message = format = "blah %d blah blah \nblah blah %s blah" interventionsize = number userid = string string.format(dic.message,interventionsize,userid) 

how can make line break in case, cannot find answer.

btw, cannot use kind of framework or external jar (old code) have use plain old java.

having \n in format string fine.

perhaps should try platform specific new-line. format strings can use %n.

that is, try following:

string.format(dic.message.replace("\\n", "%n"), interventionsize, userid); 

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -