|
-
Mar 13th, 2006, 04:13 AM
#1
Thread Starter
Fanatic Member
MessageFormat
I have this code
Code:
public class HelloWorld {
public static void main(String[] args) {
Object[] param = new Object[] {"some_value"};
System.out.println(MessageFormat.format("select * from test where column1 = '{0}'", param));
}
}
But it outputs
select * from test where column1 = {0}
and I need select * from test where column1 = 'some_value'
Oh ok, I can get it to have
Code:
Object[] param = new Object[] {"'some_value'"};
System.out.println(MessageFormat.format("select * from test where column1 = {0}", param));
and outputs fine. But is there any way I can have the single quote on the .format's parameter? I mean, given by someone I can have some_value to be a final static String member, so I guess it would be better if single quote is on .format method parameter string.
Thanks in advance!
Last edited by nebulom; Mar 13th, 2006 at 04:18 AM.
-
Mar 13th, 2006, 04:18 AM
#2
Thread Starter
Fanatic Member
Re: MessageFormat
Hmm. Nevermind (and thanks/sori for bothers).
Within a String, "''" represents a single quote.
http://java.sun.com/j2se/1.5.0/docs/...ageFormat.html
-
Mar 13th, 2006, 07:51 AM
#3
Re: MessageFormat
glad you could help you
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|