This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "need help" Watch "need help" New topic
Author

need help

mandy fern
Greenhorn

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
Greenhorn

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

Joined: Mar 16, 2001
Posts: 984

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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: need help
 
Similar Threads
Project Retrospectives by Normal L Kerth
Java vs. Visual Basic
Simple programs for SCWCD prep from HFSJ
For Jim
Discussion of Naming Policy