Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can we have parametrized String in java ?

 
raminaa niilian
Ranch Hand
Posts: 551
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
thank you for reading my post
i want to know can we have parametrize String in java ?
for example i need a template string like :

"you have contact us from email address [param] and here is your detialed answer"+
"your transfered amount is "+ [param]
"your purchased service is "+[param]
....
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. Have a look at the MessageFormat class.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15359
39
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or, if you are using Java 5 or newer, the method String.format().
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic