letter count problem

letter count problem

i have a problem in my java coding to count two characters of a string.

eg to count the letter "ou" in the string "How do you feel today?". The answer should be 5. but i still have error compiling it

here is my coding:

public int countCharset(String s, String cc)
{
return
s.equals("") ? 0 :
s.charAt(0) == cc ? 1 + countCharset(s.substring(1), cc) :
/*else*/ countCharset(s.substring(1), cc);
}

-> how can i make the char cc into string?
View Answers









Related Tutorials/Questions & Answers:
letter count problem - Java Beginners
letter count problem  i have a problem in my java coding to count two characters of a string. eg to count the letter "ou" in the string "How do you feel today?". The answer should be 5. but i still have error compiling
frequency of a letter in a string
frequency of a letter in a string  Could someone answer in netbeans please Write a program that takes in a string and a letter from the user and displays the number of appearances of the entered letter in the entered string
Advertisements
letter counting for the smallest word
letter counting for the smallest word  How do I program my java program to only count the letters in the smallest of two words? this is what I have... static void count(final String str){ Runnable readRun1 = new Runnable
ModuleNotFoundError: No module named 'letter'
ModuleNotFoundError: No module named 'letter'  Hi, My Python... 'letter' How to remove the ModuleNotFoundError: No module named 'letter'... to install padas library. You can install letter python with following command
ModuleNotFoundError: No module named 'letter'
ModuleNotFoundError: No module named 'letter'  Hi, My Python... 'letter' How to remove the ModuleNotFoundError: No module named 'letter'... to install padas library. You can install letter python with following command
how to delete a letter in a word?
how to delete a letter in a word?  how to delete a letter in a word? for example if i enter= roseindia, i want to delete 's', then output= roeindia
Automatic Capital letter
Automatic Capital letter  Morning sir, Can you help me, i want to make a automatic capital letter. I have a jTextfield1, if i type aaaaaa ,it will be automatic AAAAAA. can you help me give a source code. Thank you very much
ModuleNotFoundError: No module named 'letter-list'
ModuleNotFoundError: No module named 'letter-list'  Hi, My Python... 'letter-list' How to remove the ModuleNotFoundError: No module named 'letter-list' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'phoenix-letter'
ModuleNotFoundError: No module named 'phoenix-letter'  Hi, My... named 'phoenix-letter' How to remove the ModuleNotFoundError: No module named 'phoenix-letter' error? Thanks   Hi, In your python
POI Word document (Letter Template)
POI Word document (Letter Template)  Dear Team, i need code for generating word document(letter format). i am unable to get the code for formats, font settings, letter type settings. please help me for the same. Thanks
count in hibernate .
count in hibernate .  How to implements count in hibernate
Welcome! to the News letter archive
News Letter Archive     ... letter sent our users.  ADS_TO_REPLACE_1 Newsletters are regularly... Letter Archive Date Subject
count the users?
count the users?  how to get the number of users logged in any application
Count number of "*"
Count number of "*"  I have this code to count the number of * from...:"); String text = bf.readLine(); int count = 0; for (int i = 0; i...); if (c=='*' ) { count
Check for character is letter or not.
Description: This tutorial demonstrate the use of Character.isLetter() method which checks whether the value stored in char data-type variable is letter or not. Code: public class CheckLetter 
count characters
count characters  i have to print the total number of char 'A' in all... sabah sarawak terengganu the output must be count the total number of char... main(String[] args) { int count=0; Scanner input=new Scanner
Check for character is letter or digit.
Description .style1 { background-color: #FFFFCC; } Description: This tutorial demonstrate how to check a character variable value is a digit or letter using isLetterOrDigit() method. Code:ADS_TO_REPLACE_1
Count Vowels
Count Vowels   Read a string from the user, your program counts the number of vowels in the text and have it report a sum of each vowel found as well as the number of spaces. Make it in two classes
ModuleNotFoundError: No module named 'odoo10-addon-mail-as-letter'
ModuleNotFoundError: No module named 'odoo10-addon-mail-as-letter'  ...: No module named 'odoo10-addon-mail-as-letter' How to remove the ModuleNotFoundError: No module named 'odoo10-addon-mail-as-letter' error? Thanks
ModuleNotFoundError: No module named 'odoo9-addon-mail-as-letter'
ModuleNotFoundError: No module named 'odoo9-addon-mail-as-letter'  Hi...: No module named 'odoo9-addon-mail-as-letter' How to remove the ModuleNotFoundError: No module named 'odoo9-addon-mail-as-letter' error? Thanks
ModuleNotFoundError: No module named 'trytond-account-dunning-letter'
ModuleNotFoundError: No module named 'trytond-account-dunning-letter' ...: No module named 'trytond-account-dunning-letter' How to remove the ModuleNotFoundError: No module named 'trytond-account-dunning-letter' error
ModuleNotFoundError: No module named 'ascii-letter-classifier'
ModuleNotFoundError: No module named 'ascii-letter-classifier'  Hi...: No module named 'ascii-letter-classifier' How to remove the ModuleNotFoundError: No module named 'ascii-letter-classifier' error? Thanks   
count objects php
count objects php  How to Count and show objects in PHP
Count Rows - JSP-Servlet
Count Rows  How to count rows in Java. Thanks
How to delete line starting with a letter in java Regex?
How to delete line starting with a letter in java Regex?  Hi, i 'm trying to code with regex and java. i want to know how it's possible to delete lines which starts with a letter like G or g in a text. i tried
J2ME count character into string
J2ME count character into string  i am new in J2ME, my problem is how to count character into number, i had been research google for almost 2 days and got nothing...some one plz give me a punch :) as an example, 1. i got a text
Count letters in a string.
Description: This tutorial demonstrate how to find number of letter exists in a string. The str.length() method find the length of string. Code: public class CheckLetterInString {   
ModuleNotFoundError: No module named 'the_count'
ModuleNotFoundError: No module named 'the_count'  Hi, My Python... 'the_count' How to remove the ModuleNotFoundError: No module named 'the_count' error? Thanks   Hi, In your python environment you
SQLl query count and group by
SQLl query count and group by  How to write a sql query to count and group by the data?   Sql query to count the data and group the data using group by function... Select Name, Count(Name) As Count From Table Group
Hibernate Criteria Count Example
Hibernate Criteria Count Example  Example of Hibernate Criteria Count. Check the tutorial Hibernate Criteria Count. Check the Latest tutorials, articles and examples of Hibernate Framework. Thanks
php array loop count
php array loop count  Count the array using loop in php
palindrome array problem
in an array Palidrome[250][5] all the 5 letter words using {a, b, c} Write the code and show the execution for: a.) Count the number of palindromes in this set. b.) Print out all the palindromes where a letter appears more than twice
MySQL Count
MySQL Count       This example illustrates how to use count() in MySQL database. Count(): The Count.... It returns a numeric value. If you use COUNT(*) that counts the number of rows.ADS
retain count in Objective C
retain count in Objective C  what is the retain count in Objective C?   retainCount in Objective c retainCount: retain count method is used to show the internal count of the given object so that programmer can easily
Count the character in java
Count the character in java  Write a java program to count....   Count characters by implementing thread import java.util.*; class CountCharacters { public static void count(final String str){ Runnable
Please provide the coding for this problem
for the following problem. Write a "hangman" game that randomly generates a word and prompts the user to guess one letter at a time. Each letter in the word... letter is then displayed. When the user finishes a word, display the number of misses
Character count by while loop
Character count by while loop  Write the program to count the number...]; int count=0; for ( int i=0; i<third.length; i++){ if (ch==third[i]) count++; } boolean flag=false; for(int j=counter-1;j>=0;j--){ if(ch==third[j
Count distinct value in HQL.
Count distinct value in HQL.  How do you count distinct value in HQL?   count(distinct fieldName) returns number of distinct value... = sessionFactory.openSession(); String countHql = "Select count(distinct salary
count values using jsp - JSP-Servlet
by array count can you help me to sort out this problem expecting your favourable...count values using jsp  hai deepak i have a query i am... and subheadings i want to get the count of textboxes which are heading under that how
Hibernate criteria count.
Hibernate criteria count.  How do we count rows using criteria in hibernate?   We can get the rows count using the Projections. My code is like this: Criteria criteria = session.createCriteria(getReferenceClass
Hibernate Count
In this section you will learn different way to count number of records in a table
Display first letter of every word in uppercase
Display first letter of every word in upper case In this Java tutorial section, you will learn how to display the first letter of every word in uppercase...;inputString = br.readLine(); FirstLetter letter=new FirstLetter
count in java - Java Beginners
count in java  Hello javamania.... i want to ask something like... is 20. i have JFrame Form(jTextField,jLabel,jButton), i want to get count of gender, like if jTextfield =male then count of male=50 and if jTextfield=female
Count number of characters in a column.
Count number of characters in a column.  I just need you suggestions. Am from Biology Back ground. I just need to find out number of characters... to count characters in 1st, 2nd, 3rd columns seperatly and also print flase if i
Count Row - JSP-Servlet
Count Row  Hello all, Please I need your help on how to desplay... db = "register"; String driver = "com.mysql.jdbc.Driver"; int count= 0...(); ResultSet res = st.executeQuery("SELECT COUNT(*) FROM regiform
Count words in a string method?
Count words in a string method?  How do you Count words in a string...=br.readLine(); int count=0; String arr[]=st.split... count the length of arr which return the number of words in the inputted string
count asterisk in a grid - Java Beginners
count asterisk in a grid  I need to write a program that uses a recursive method to count the number of asterisk in a square grid
Using Min, Max and Count on HQL.
Using Min, Max and Count on HQL.  How to use Min, Max and Count on HQL
Count instances of each word
Count instances of each word  I am working on a Java Project that reads a text file from the command line and outputs an alphabetical listing of the words preceded by the occurrence count. My program compiles and runs
Hibernate Criteria Count Distinct Example
Hibernate Criteria Count Distinct Example  I am learning Hibernate... Criteria Count Distinct. Can anyone tell me the best place to learn Hibernate Criteria Count Distinct? Thanks   Here is an example of Hibernate Criteria

Ads