This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund 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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply 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: 965

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: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: need help
 
Similar Threads
For Jim
Project Retrospectives by Normal L Kerth
Simple programs for SCWCD prep from HFSJ
Java vs. Visual Basic
Discussion of Naming Policy