Preparing a String  
Author Message
pranavluhar@gmail.com





PostPosted: 2004-10-26 6:08:00 Top

java-programmer, Preparing a String 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

 
Real Gagnon





PostPosted: 2004-10-26 7:25:00 Top

java-programmer >> Preparing a String > 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.
--
Real Gagnon from Quebec, Canada
* Looking for Java or PB snippets ? Visit Real's How-to
* http://www.rgagnon.com/howto.html
 
pranavluhar@gmail.com





PostPosted: 2004-10-29 23:48:00 Top

java-programmer >> Preparing a String Thanks
its working for me