Hi,
I wrote a python program that counts the occurance of each alphabetic character in a string and it works fine. I tried to port it over to java but now it fails, telling me that there is no alphabetic characters at all in it.

for (int i=0;i<alphabet.length;i++)
{
	for (int q=0;i<string.length();i++)
	{
		if alphabet[i]==string.CharAt(q)
		{	
			alphcount[i]++;
		}
	}
}

Here is the algorithm, the alphabet is stored as a char array. Alphcount is an int array that has an entry corresponding to each alphabetic character.

Any ideas?
Thanks.

Line 3 you confuse q and i.

My word, what a ridiculous mistake to make.

Thanks for your time.

We've all done it sometime :-) Mark this is solved?

james is right...:icon_mrgreen:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.