Originally posted by lynn fann: IF YOU ARE NOT GOING TO HELP, THEN DONT TALK SO MUCH. IS A COMPANY PROJECT ALREADY. IM NEW TO JAVA.
JavaRanch is a site devoted to Learning Java. It is also a moderated site. As such, you are requested in following certain rules -- including this, this, and this. Now, as for this last one, this may not be homework, but it is a common question that is used for learning java.
Now you are getting close to violating the Ranch's "Be Nice" rule, which is not tolerated here.
Joined: Jun 09, 2003
(I can't see it as being anything but homework)
Anyway, you would do it exactly the same way as if you were doing it on paper: look at the letter, then look at the other letters and remove matches.
the String methods you are likely to use are charAt() indexOf() lastIndexOf()
and, if you end up doing this in a loop, it might be better for you to work backwards
Joined: Jan 29, 2003
I actually kind of liked the Set approach. Look at the doc - What does it do if you try to put in two objects that are equals()? You could put every letter in the string and the Set would contain exactly what you're after. It's likely less efficient - have to convert chars into objects of some kind - but pretty well self-documenting.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi