FAQ Database Discussion Community

Named message params

I was often using MessageFormat for indexed params in situations like this: String text = MessageFormat.format("The goal is {0} points.", 5); Now I encountered a situation where I need to handle messages which are in the following format: "The {title} is {number} points." So, values are not indexed anymore and...

Scala: Better way for String Formatting to PhoneNumber and using Java's MessageFormat

I'm looking for a better way to better implement the following: I have imported import java.text.MessageFormat to set the format I would like. val szphoneFrmt holds the format I would like. val szInitialString is set to the value I pulled from the database. val szWorkString breaks up the string via...

“Bad argument syntax” with MessageFormat

I got this html syntax which is filled with help of a MessageFormat: private final String WRAPPABLE_HTML = "<html><head>" + "<style>div:after{text-decoration: line-through;}" + "</style></head>" + "<body style='width:{0}px;margin: 0 auto;'><div>{1}</div>{2}</body></html>"; if I call: MessageFormat.format( WRAPPABLE_HTML, 200, lCat,lDog); I get: Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Bad argument syntax: text-decoration: lin ... at...