1702 Shares

How do you find the last name?

How do you find the last name? Topic: Case select in java
May 22, 2019 / By Doretta
Question: Xiaoshan Zhang Erik V. Agard Fang Y. Cao Tyler L. Fultz Mary Ann Dvorsky Robert P. Huang Neelnavo Kar Prince Lisa Ma Cy A. Neita Qinlan Shen Pope Benedict XVI Nancy Y. Wen Jonathan B. Song Sean Shiang Ari W. Schaler Wenting Ma Martin Luther King, Jr. Michael J. Lee Grace S. Hummel Brian R. Goodall Daniel A. Farias Alexandr Belov King Henry VIII Miranda L. Bernard Guodong Fu James D. Hill Shelley Jin Dennis Li Daniel S. Naval Madonna T. J. Elliott Rafael G. Setra Kris Shin Jed T. Tan Mandy Xu These are the names of the people. Now, I have to write a method in Java to find the last name. PLEASE HELP ME!
Best Answer

Best Answers: How do you find the last name?

Cassidy Cassidy | 2 days ago
==>Store the names in an array. ==>There are multiple possibilities •If the given name consists of two parts, that is, the first name and the last name, then you can use the string.indexOf(" ") method to determine the location of space and consider the name occurring after the space as the second name • If the name consists of three parts, that is the first name, middle name and the last name, you can use string.lastindexOf(" ") to determine, the last occurrence of space, and consider the name occurring after that position as the last name. •If the first name is followed by an initial, followed by a period and then the last name, use the indexOf(".") method to find out its position and then obtain the last name, using the substring() method. ==> However, I'm not sure how to find out the last name in case of King Henry VIII. How do you find that? What is the last name? Try coding as per this suggestion. Hope this helps. If it does, please select my answer as the best one!! Happy programming :)
👍 212 | 👎 2
Did you like the answer? How do you find the last name? Share with your friends

We found more questions related to the topic: Case select in java


Cassidy Originally Answered: Can someone help me find a site where i can find critical reviws on famous literatures?
For CS Lewis literary criticism, see link 1 For Cervantes criticism, see link 2 Regret I cannot find anything on William Osler and, without an author for the novel "Snow" I can't do a search. Hope this is of some help anyway.

Annabel Annabel
You will have to capture the last part of each name, which will give you the last name. But if the last name is preceded with a comma or if the last name is a roman number, you will have to go to the part before that. You could use a tokenizer or a regex.
👍 90 | 👎 -7

Winfred Winfred
If the names are in an array, then go through the array and do a string compare for the name you're looking for. Say its held in variable searchName searchName = "Naval"; if (searchName.compareTo("Naval")==0)//foun... it do some thing
👍 89 | 👎 -16

Winfred Originally Answered: I have W XP Home ,I have cdRW &I don't find any software to use to burn.Where can I find.?
Infra recorder - If you don’t have a Nero (OEM or retail) for your CD or DVD burner or some other burner application, Infra recorder is a good free alternative. Not only that, it’s a lot less bloated and it has a small memory foot print. While Nero has some great functionality, it comes with too many applications and extra features that gunk up the system though you don’t have to install all those features. It won’t let you do simultaneous DVD or CD burning or other advanced things that Nero lets you do, but it does what it does well and it’s a lot better than what comes with Windows XP or Vista.

If you have your own answer to the question case select in java, then you can write your own version, using the form below for an extended answer.