27.04.2013 Views

330 Java Tips.pdf - FTP Server

330 Java Tips.pdf - FTP Server

330 Java Tips.pdf - FTP Server

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

String, text, numbers, I/O I part<br />

Receive our newsletter with new tips! Almost 6,000 subscribers (by June 2001) can not be wrong!<br />

They read our tips every week! To subscribe to The <strong>Java</strong> FAQ Daily send empty e-mail to:<br />

javafaq-tips-subscribe@topica.com or visit at:<br />

http://www.topica.com/lists/javafaq-tips/<br />

String, text, numbers, I/O I part<br />

An idea for validating the phone number field on a form..,<br />

Does anyone have an idea for validating the phone number field on a form. I am<br />

looking for something that will basically check this input mask<br />

*111*111*1111*<br />

Where the 1's are number's and the *'s are either - . spaces, or any<br />

other character like (). Please advise.<br />

Answer1: You could use a regular expression package. For example, Jakarta ORO:<br />

http://jakarta.apache.org/oro/<br />

Answer2: i'm thinking regular expressions. See:<br />

http://www.cacas.org/java/gnu/regexp/<br />

http://www.crocodile.org/~sts/Rex/<br />

Could someone show me a basic File I/O example? I just can't figure out<br />

streams. I'm willing to accept basic mockery in exchange...<br />

Could someone show me a basic File I/O example? I just can't figure out streams.<br />

I'm willing to accept basic mockery in exchange...<br />

Answer:<br />

import java.io.*;<br />

public class FileIO {<br />

public static void main(String[] args) throws Exception {<br />

if(args.length!=1){<br />

file:///F|/350_t/350_tips/stings_text__date_numbers_io-I.htm (1 of 7) [2002-02-27 21:19:16]<br />

Visit us here and you will find<br />

much more tips!

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!