![]() |
Sponsored Link •
|
Advertisement
|
Advertisement
|
This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.
Message:
I DIDN'T WANT TO BE PERSONAL.... I'll try to contemplate more and perhaps figure out the answer myself.
> > charAt() - to get the specific character from the string, and possibly the array, and compare both to see whether it's equal or not. > what i mean in "array" here is the "array" of your character list in the form of String. i.e. String charlist="abcde...". sorry to use the word "array" there. it doesn't literally mean the word array as in charlist[]. > > indexOf() - well this is just to save you from looking at redundant characters, rather than checking every characters from the *beginning* of the array of either your string or character list (you can store your character list as a string, or well, an array), you just use indexOf() to get the first occurence of the character. > again, what i mean here is that, if you store your character list in the form of array (charlist[]) you would have to fetch every single character from the beginning itself to find out which letter was it. so, rather than all that hassle, an easier way is to store the character list as a String and retrieve the first occurence of the specific character (to know which character it is).
Replies:
|
Sponsored Links
|