aspose file tools
The moose likes Java in General and the fly likes Problem while displaying ' using MessageFormat Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Problem while displaying Watch "Problem while displaying New topic
Author

Problem while displaying ' using MessageFormat

An Sush
Ranch Hand

Joined: Jan 17, 2007
Posts: 47
Test.java:

Prop.properties

It outputs :


So as seen the ' is missing and it doesnt substitue the parameter values also. It seems that by having '' (2quotes) in properties file:
Prop.properties

the outputr comes as intended:

Can anyoone tell me whats wrong with the original code? any better workaround? I have modified as follows but not sure if thats the correct way to handle ' coming via properties file:
Modified Test.java
Jesper de Jong
Java Cowboy
Bartender

Joined: Aug 16, 2005
Posts: 12911
    
    3

There is nothing wrong; this is just how MessageFormat works. The single quote has a special meaning in the strings you pass to MessageFormat; it can be used for quoting other special characters, so you can include those characters literally in the format pattern.

See the API documentation of class MessageFormat for a detailed explanation.
[ March 20, 2008: Message edited by: Jesper Young ]

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Problem while displaying ' using MessageFormat
 
Similar Threads
Regarding ListResourceBundle
Problem with ResourseBundle.Control
XML reading issues
Problem with ResourseBundle.Control using struts
Problem with ResourseBundle.Control using struts