Java string format

I have a property file containing strings in the following format:

audit.log.events.purged=The audit events were purged. {0} events were purged,{1} assets were deleted.

Is there any way to bind the values in {0} and {1} using some standard APIs, or should I create some code to parse these strings?

Solution

You are looking for messageformat: http://java.sun.com/j2se/1.5.0/docs/api/java/text/MessageFormat.html

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>