characters java

characters java

View Answers

October 10, 2008 at 1:41 PM

exactly whar u want?

1) No of character appeared in the word
2) Suppose a word contain two "a" if i enter 3 times "a" then what happens

mention proper

October 13, 2008 at 6:07 PM

Hi friend
I hope the following code helps you
one thing i tel u honestly that i didnt understand whats the purpose of boolean array n how r u going to use that...

anywhy i written the follwing code n i dont know how much its going to help you


import java.io.*;
import java.util.*;


class SearchExample
{

String str=new String();
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int j=0;

void found()
{
try{
str=br.readLine();
} catch(IOException e){}
int j=str.length();
System.out.println("");
System.out.println("The word " +str + " has " +j +" characters");
System.out.println("");
}

int count(char ch)
{
int count=0;
for(int i=0;i<str.length();i++)
{
if(ch==str.charAt(i))
count++;

}


return count;
}

void display_ch(char b[])
{

System.out.println("you found these letters");
System.out.println("");
System.out.print(b);

}

public static void main(String args[])throws IOException
{

char i='\0';
char[] buf=new char[10];
int j=0;
int count;
SearchExample ex=new SearchExample();
System.out.println("Enter the data..");
ex.found();
do{
System.out.println("What letter would you like to guess?(Enter zero to quit.) ");
System.out.println("");

i = (char) System.in.read();
count=ex.count(i);
System.out.println("character "+i+" found "+count+" times");
System.out.println("");
if(count>0)
buf[j++]= i;

}while(i != '0');
ex.display_ch(buf);
}
}

Thanks...









Related Tutorials/Questions & Answers:
Java characters
Java characters  How many bits are used to represent Unicode, ASCII, UTF-16, and UTF-8 characters
Uppercase Characters in Java
Uppercase Characters in Java  I want to know how to UpperCase Characters in Title useing a java code...?   Use toUpperCase() method to convert the string in uppercase letters. class UppercaseString { public static
Advertisements
characters java - Java Beginners
characters java  HELLO MAM AND SIR I ASK YOUR HELP HOPE YOU GONNA....(REmember that the alphabet contains 52 characters if you count uppercase... you input that word) The word howdy has 5 characters. What letter would you
Count characters from text file in Java
Count characters from text file in Java  At the "Count chracters fro mtext file in Java". I tried to run the code, but the error at the line have... is a java code that count the occurrence of each character from text file. import
writing characters
writing characters  how to write a group of characters to a string ... i mean for writing single character using charAt in java
Unwanted characters instead of arabic characters
Unwanted characters instead of arabic characters  I am using... and using it to display. the problem is: I need to display some arabic characters here... صÙ?Ù?دÙ?Ù?Ø© سÙ?Ù?د Ù?Ù?Ù?Ù?Ù?أرب like characters instead of arabic
Java count characters from file
Java count characters from file In this section, you will learn how to count characters from the file. Description of code: Firstly, we have used FileReader and BufferedReader class to read the file 'data.txt' and stored the data
special characters in my HTML
special characters in my HTML  How do I get special characters in my HTML
special characters in my HTML
special characters in my HTML  How do I get special characters in my HTML
Protect Special Characters.
Protect Special Characters.  How To Protect Special Characters in Query String
ModuleNotFoundError: No module named 'characters'
ModuleNotFoundError: No module named 'characters'  Hi, My Python... 'characters' How to remove the ModuleNotFoundError: No module named 'characters' error? Thanks   Hi, In your python environment you
remove special characters iphone
remove special characters iphone  remove special characters iphone   Remove special characters iphone from Password NSString *outputString = [passwordString stringByReplacingOccurrencesOfString:@"%" withString
PDF Generation for unicode characters
PDF Generation for unicode characters  Hi, How a PDF file having unicode characters is generated in JSP
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
regular expression for special characters
regular expression for special characters  How to find out regular expression for special characters
Remove Repeated Characters from the String
Remove Repeated Characters from the String In this we are going to remove repeated characters from the string. For this, we have allowed the user to enter...}(?:(?=\\1).))" method that have removed all the repeated characters. Here
replace special characters in html
replace special characters in html  How can i replace the special characters in HTML?   Special Character in HTML HTML has a long list of special characters symbol that can be used anywhere throughout the HTML Code
Removing characters from a string
Removing characters from a string  Removing characters from a string   Example: public class CharReplace{ public static void main(String []args){ String str="Hello 123.you are At 3456"; String
Limiting characters - JSP-Servlet
Limiting characters  Iam doing a jsp project. In this i have a text area which should accept not more than 300 characters. I solved this with backspace and delete keys. But, i cannot solve problem of pasting through shortcut ctrl
Remove unknown characters php - PHP
Remove unknown characters php  i am looking for a script that can remove unknown characters in PHP code except white spaces
How to find the first 6 characters of string in regex?
How to find the first 6 characters of string in regex?  How to find the first 6 characters of string in regex. I know the Syntax is to String.substring(strtindex, endindex-1) For first six characters is:ADS
ModuleNotFoundError: No module named 'control-characters'
ModuleNotFoundError: No module named 'control-characters'  Hi, My... named 'control-characters' How to remove the ModuleNotFoundError: No module named 'control-characters' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'control-characters'
ModuleNotFoundError: No module named 'control-characters'  Hi, My... named 'control-characters' How to remove the ModuleNotFoundError: No module named 'control-characters' error? Thanks   Hi, In your
How to Remove Repeated Characters from the String?
How to Remove Repeated Characters from the String?  Hi, I trying to develop an application which will remove the repeated characters from... the example of how to remove repeated characters from the string. Please visit
How to avoid the Special characters? - JDBC
can I override special characters by submitting a form through JAVA...How to avoid the Special characters?  I have a form in jsp...,   hi friend, To avoid special characters we have imposed some
Remove duplicate characters from the string
Remove duplicate characters from the string In this tutorial, you will learn how to remove duplicate characters from the string. Java has provide several methods to examine the content of string, finding characters or substrings
Iterating the Characters of a String
Iterating the Characters of a String This section illustrates you how to iterate the characters of a string. For bi-directional iteration over the text , you... this interface for the string. In CharacterIterator, characters are indexed
Stripping of unwanted characters from string
Stripping of unwanted characters from string  how to strip off unwanted characters from a string   Hi Friend, Try this: public class StripCharacters { public String strip(String s) { String st
How To Protect Special Characters in Query String?
How To Protect Special Characters in Query String?  How To Protect Special Characters in Query String
write Greek ( or other non-ASCII/8859-1 ) characters to a database
write Greek ( or other non-ASCII/8859-1 ) characters to a database  How do I write Greek ( or other non-ASCII/8859-1 ) characters to a database
problems in parsing the xml with the special characters
problems in parsing the xml with the special characters  Hi, I have a problem, in while parsing the xml with special characters apstrophe('). I am getting the exception Caused by: javax.xml.transform.TransformerException
how can i remove newline characters and tabs
how can i remove newline characters and tabs   how can i remove newline characters and tabs ? but i wont to using GUI .please help
Escaping Special Characters in a Pattern
Escaping Special Characters in a Pattern   ... characters from the given string or text. Here, you can learn the way of detecting all special characters present in the given string. Program Result:ADS
Count characters from text file in Java
Count characters from text file Using Java Here we are going to count the occurrence of each character from the text file. For this, we have used the BufferedReader  class to read the specified file. Then we have removed
how to get string between two characters
how to get string between two characters  hgow to get string from between two characters. ex:[email protected] from the above word i want a string between characters . and @ send the required method and give better example
MySQL replace all non alphanumeric characters
MySQL replace all non alphanumeric characters  Hi, How to replace all non alphanumeric characters in MySQL? Thanks (adsbygoogle = window.adsbygoogle || []).push
input fields to reject all inconsistent characters in webconfig
input fields to reject all inconsistent characters in webconfig  I would like to write this statement in the webconfig as specified by my client. The purpose is to set the input fields to reject all in-consistent characters
incrementing characters
count characters
unicode characters
unicode characters
unicode characters
Repeat word as many times as it has characters
Repeat word as many times as it has characters in Java This section illustrates you the repetition of same word as many times as it has characters in it. To do this, we prompt the user to enter the word using the Scanner class. After
HOW WRITE GREEK CHARACTERS INTO MYSQL BY JSP ?
HOW WRITE GREEK CHARACTERS INTO MYSQL BY JSP ?  HALLOW TO ALL ! I'M USING MYSQL5.5 , TOMCAT7 & JSP. IN MY BROWSER I'M SEEING GREEK CHARS BECAUSE OF UTF-8 ENCODING . WHEN I RETRIEVE DATA FROM DATABASE BY SELECT * FROM
Explain the use of the ?LIKE? keyword used in the WHERE clause? Explain wildcard characters in SQL.
Explain the use of the ?LIKE? keyword used in the WHERE clause? Explain wildcard characters in SQL.  Explain the use of the ?LIKE? keyword used in the WHERE clause? Explain wildcard characters in SQL
Explain the use of the ‘LIKE’ keyword used in the WHERE clause? Explain wildcard characters in SQL.
Explain the use of the ?LIKE? keyword used in the WHERE clause? Explain wildcard characters in SQL.  Explain the use of the ?LIKE? keyword used in the WHERE clause? Explain wildcard characters in SQL
Java String
Java String       In this section, you will learn about the java string. Java String is a set of characters such as the string "Hello". It is a combination of H, e, l, l, o
Count Characters from the input string Java
Count Characters from the input string of Java In this section, you will learn how to count the occurrence of each character in the string. For this, we have prompted the user input the string. The BufferedReader class read
Java Number Format
Java Number Format       In programming languages, a pattern of special characters is used to specify the format of the number. In java this is achieved by the java.text.NumberFormat
PHP - Match Special Characters - PHP

Ads