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 PostString 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 PostGeekTool: take a look at the java api's, check what the indexOf method does, and explain why you think he used -1 as comparator.
Jump to PostI have given you a hint to reach your goal. I cant solve all of your problem by pasting code. Its against the rule of this forum. In the above code i provided you a way to do some task over that strings which dont have p. So you simply …
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,116 Posting Maven Featured Poster
GeekTool 0 Junior Poster in Training
Majestics 84 Posting Pro
GeekTool 0 Junior Poster in Training
stultuske 1,116 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.