• Post Reply Bookmark Topic Watch Topic
  • New Topic

Reading Properties with dynamic parameters  RSS feed

 
granjith kumar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a .properties file with a key-value defined like this:

logout.message= Hi {0}, you have logged out successfully. To go to home page click here {1}.

The message I want to send to user interface should be like "Hi John, you have logged out successfully. To go to home page click here www.myapplication.com"

I need to know what class should I use if I want to read the value and insert parameters in {0} and {1}. In the past I used to work with this, but I cannot remember what class I used to solve this.

Thanks in advance!
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16059
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use class java.text.MessageFormat to fill in the parameters of such strings.
 
granjith kumar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!