I tried and tried to figure ways but cant, could someone please tell me a good way to read a name as a string, and manipulate it? I need to do this: Enter: John, Doe E. Output: Doe E. John When you see the ',' you have to put the word in front of it on the back, but I dont even know how to do that with string. Also another bad thing is that I have to read the string all at once. So could someone point me to the right direction?
I think String.split would be a better option. split the string iterate through each element of the collected string elements look for the ',' in each string and then perhaps place them in another string
Hi Pls, Clarify one thing, r u getting input as a parametter for the program, or by any other source of input like data base. if it is the first case, the space between the word split the data and you won't get the expected input.
If it is the second case use this code as narain told.