File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes Mask - Format Record List Telephone Column Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "Mask - Format Record List Telephone Column" Watch "Mask - Format Record List Telephone Column" New topic
Author

Mask - Format Record List Telephone Column

Lynn Paustian
Greenhorn

Joined: Sep 12, 2006
Posts: 2
I have a JSF page with a records list. One of the columns is telephone. I want to mask it with hyphens at the usual breaks. Some of the phone numbers are 7 characters and others are ten. I'm using RAD to create my faces pages. RAD will format for 7 or 10 but not both. Is there a way to get the length of the telephone for the column in each row and in turn use the appropriate mask?

I've hunted IBM's site without any luck. I've got to believe there is a nice cheat sheet for reformating record list and records. If you know of a source I'd like to get it.

Thanks in advance.
Saurabh Chandra
Greenhorn

Joined: Feb 28, 2008
Posts: 2
Dear Lynn,
Did you get any solution for that??

Originally posted by Lynn Paustian:
I have a JSF page with a records list. One of the columns is telephone. I want to mask it with hyphens at the usual breaks. Some of the phone numbers are 7 characters and others are ten. I'm using RAD to create my faces pages. RAD will format for 7 or 10 but not both. Is there a way to get the length of the telephone for the column in each row and in turn use the appropriate mask?

I've hunted IBM's site without any luck. I've got to believe there is a nice cheat sheet for reformating record list and records. If you know of a source I'd like to get it.

Thanks in advance.
Marcelo Rodriguez
Greenhorn

Joined: Feb 28, 2008
Posts: 6
Try this:

Pattern p = Pattern.compile("\\d{1,2}-\\d{3,5}-\\d{34}-[0-9xX]{1}");

try to format in this pattern... I haven't tested 'cause I'm trying to use this as a Matcher to validate Strings.

remember to change the parameters, study the sintax and Good Luck!


- The powerfull men can destroy one rose or two, they can even destroy the Spring (and Struts), but they will never defeat Java Server Faces (Only Tapestry can do that...) - 'Ctrl+C, Ctrl+V of Che Guevara Quote, with cH4n6Es'
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Mask - Format Record List Telephone Column
 
Similar Threads
B&S: Reading a deleted record - best way to handle this
How to add JPA ManyToMany records?
How to avoid duplicate inserts in JPA HQL (EJB 3.0 - Java EE 5)
hibernate criteria
insert multiple values into a single column