Preparing a String

P

pranavluhar

Hello
I am preparing xpath queries for xml parsing.

To make each xpath query i have to add variables and join more Strings.
I was wondering if there is any way i can create java string same as
SqlPrepareStatement
somthing like
String p = "my name is ?"

public void foo("joe"){
//add name in string p so that
//p = "my name is joe"
}


any help
thanks
Pinto
 
R

Real Gagnon

To make each xpath query i have to add variables and join more Strings.
I was wondering if there is any way i can create java string same as
SqlPrepareStatement
somthing like
String p = "my name is ?"

Check the java.text.MessageFormat

Object[] params = new Object[]{"hello"};
String msg = MessageFormat.format("{0} world", params);

Bye.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top