Ffirst of all, i have just achieved to code a program that counts the chosen letters. ( For example, i wanted it to count how many 'p's exist in the string. ) Now, for example i want to code a console application that extracts only the ones that are not 'p'. How can i do this with "continue" ?
GeekTool 0 Junior Poster in Training
Recommended Answers
Jump to Post— Sky Diploma 571Post in your ideas or some initial code and try to get started. Then we can make it interactive to get to the final result :)
Jump to Post— Majestics 84String s = "i am a p"; if(s.indexOf("p") == -1) //Index of method checks wether the character is present or not methodForCountingAllAlphabet(s); // count if p is not present else continue(); // leave the string if p is present. This all the logic u require.
Jump to Post— stultuske 1,129GeekTool: take a look at the java api's, check what the indexOf method does, and explain why you think he used -1 as comparator.
All 9 Replies
Sky Diploma 571 Practically a Posting Shark
Majestics 84 Posting Pro
GeekTool 0 Junior Poster in Training
GeekTool 0 Junior Poster in Training
stultuske 1,129 Posting Maven Featured Poster
GeekTool 0 Junior Poster in Training
Majestics 84 Posting Pro
GeekTool 0 Junior Poster in Training
stultuske 1,129 Posting Maven Featured Poster
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.