tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rahul Akolkar <rahul.akol...@gmail.com>
Subject Re: Formatting a phone number with JSTL?
Date Fri, 17 Jun 2005 03:41:54 GMT
On 6/16/05, Wendy Smoak <java@wendysmoak.com> wrote:
> I'm trying to format a 10 digit number stored as a String in my bean, with
> dashes after the 3rd and 6th digit.

Not sure if there is an elegant solution using <fmt:formatNumber>,
since it works off of DecimalFormat, which allows prefixes, suffixes
and grouping separators, but in this case:
1) The dash isn't a suffix/prefix
2) It cannot be a grouping separator since the separation is not uniform.

> Is there documentation that says what is legal to put in a 'pattern'?
>

Look up java.text.DecimalFormat

> (And further, how expensive is it?  I can do the String manipulation when I
> populate the bean if that makes more sense.)

Ofcourse, adding "decoratedNumber" to "phone" is one solution.

-Rahul

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


Mime
View raw message