File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes need help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "need help" Watch "need help" New topic

need help

mandy fern

Joined: Aug 21, 2001
Posts: 12
How do I write a program to extract initials from a name which has the following format:[ Dr. ] First name second first name third first name... Surname. The output should be something like this R. W. D. F.!
James Gray
Ranch Hand

Joined: Sep 10, 2001
Posts: 30
How about using a java.util.StringTokenizer to break the name into seperate tokens, ignoring title tokens like the "Dr." in your example, and otherwise storing/printing the first character of each token?
mandy fern

Joined: Aug 21, 2001
Posts: 12
How do I print first character of each token?
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 986

The "nextToken" method returns a String. So you will be printing the first character of a String (which I think you already know how to do).

Please ignore post, I have no idea what I am talking about.
I agree. Here's the link:
subject: need help
It's not a secret anymore!