Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners letter count problem
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Qwerty
letter count problem
0 Answer(s)      4 years and 3 months ago
Posted in : Java Beginners


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?

Advertisement
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
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
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
Welcome! to the News letter archive
News Letter Archive     ... letter sent our users.   Newsletters are regularly distributed...; News Letter Archive Date Subject
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 
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
count in hibernate .
count in hibernate .  How to implements count in hibernate
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
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
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
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
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 {   
Count Rows - JSP-Servlet
Count Rows  How to count rows in Java. Thanks
count objects php
count objects php  How to Count and show objects in PHP
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
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
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
display all words containing the letter which i gave as input...
display all words containing the letter which i gave as input...  If i enter any character,it have to display the names which having that character..write a program using java example(output) Enter any character: a Names: Abi
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.  
display a list of names(when we press first letter)
display a list of names(when we press first letter)  If i gave...("Enter letter: "); String letter=input.next().substring(0,1...++){ if(countries[i].startsWith(letter)){ System.out.println(countries
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
Display set of names in array when we press the first letter
click the starting letter (like in gmail if we press the letter it will show...("Enter letter: "); String letter=input.next().substring(0,1...++){ if(countries[i].startsWith(letter)){ System.out.println
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
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
Advertisements
 

 

 

DMCA.com