• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Anyone have a phone number formatter?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Anyone have a phone number formatter?


  • Subject: Re: Anyone have a phone number formatter?
  • From: Chuck Hill <email@hidden>
  • Date: Thu, 29 Mar 2007 17:09:06 -0700

If you just want output formatting (and not input parsing), it can be as simple as this:

public StringBuffer format(Object object, StringBuffer stringBuffer, FieldPosition fieldPosition)
{
if (object instanceof Number)
{
stringBuffer.append(((Number)object).intValue() == 2 ? "Y" : "");
}


        return stringBuffer;
    }



    /**
     * @throw RuntimeException parseObject is not implemented
     */
    public Object parseObject(String arg0, ParsePosition arg1)
    {
        throw new RuntimeException("parseObject is not implemented");
    }


This is an output formatter that takes a number formats this to "Y" if the value is 2 and to an empty string for all other values. Don't ask, legacy data.


Chuck




On Mar 29, 2007, at 4:58 PM, Kevin Windham wrote:

I am looking for info on how to create a formatter for phone numbers. I have surmised that I am supposed to use java.text.format in some fashion, but I am having trouble finding any examples.

Does anyone have any examples they can share, or can point me to some better info than the java docs on the class.

Thanks,
Kevin
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40global-village.net


This email sent to email@hidden


--

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects






_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • RE: Anyone have a phone number formatter?
      • From: "David Aspinall" <email@hidden>
References: 
 >Anyone have a phone number formatter? (From: Kevin Windham <email@hidden>)

  • Prev by Date: Anyone have a phone number formatter?
  • Next by Date: Fwd: WOWODC
  • Previous by thread: Anyone have a phone number formatter?
  • Next by thread: RE: Anyone have a phone number formatter?
  • Index(es):
    • Date
    • Thread