struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Lea <ja...@kumachan.net.nz>
Subject Re: [OT] MessageFormat and curly brackets
Date Thu, 26 May 2005 08:38:58 GMT
 From the java docs for MessageFormat:

 Within a String, "''" represents a single quote. A QuotedString can 
contain arbitrary characters except single quotes; the surrounding 
single quotes are removed. An UnquotedString can contain arbitrary 
characters except single quotes and left curly brackets. Thus, a string 
that should result in the formatted message "'{0}'" can be written as 
"'''{'0}''" or "'''{0}'''".

So at a guess, something like:

String str = "<arg name=\"minlength\" key=\"$'{'var:minlength}\" ";



Riyaz Mansoor wrote:

>not strictly struts ... but lots of smart guys here :)
>
>String str = "<arg name=\"minlength\" key=\"${var:minlength}\" ";
>MessageFormat mf = new MessageFormat(str);
>
>throws error saying "can't parse argument number var:minlength"
>
>how place literal curly brackets in String such that MessageFormat 
>ignores them?
>
>
>thanx for helping
>
>riyaz
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>
>  
>

-- 
Jason Lea



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message