Article View: aus.computers.java
Article #1075Re: Help, newbie..question concerning character analysis of an input text string
From: Don Vining
Date: Mon, 23 Aug 1999 00:00
Date: Mon, 23 Aug 1999 00:00
53 lines
2619 bytes
2619 bytes
Gee this sounds like a classic home work problem which you would be well advised to do yourself. You should scan the line a character at a time using the Character class as a wrapper. There are nice methods in this class which will be useful. Michael Little <hypercom@c031.aone.net.au> wrote in message news:qfbw3.7309$O_1.50063@ozemail.com.au... > Hello, > I was wondering if some-one could help me, I am trying to write a short > program to get one sentence as a command line argument and it must return > the following: > 1. The number of blank characters in the entire sentence > 2. The number of words in the entire sentence > 3. The number of non-blank characters in the entire sentence > 4. The average number of characters per word > 5. The length of the longest word( in characters) > 6. The length of the sentence( in words) > 7. The number of capital and lowercase characters > 8. The number of vowels and consonants. > The input sentence can contain letters and digits, with one or more special > characters separating each word in the sentence, and once entered the > program should print the above values. Any suggests as how to best handle > this problem? > > I am also not sure how to determine if a character is upper or lower case: > do they belong to different character ranges? > > Any help appreciated! > > > > -- > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > MIchael John Little > "Sine Timore,Per Ardua Ad Astra!" > > > Hyper Communications > "Knowledge is Power, yet True Power is Communicating Knowledge" > > 1/36 Lusher Road Croydon Victoria Australia > Tel. (61) 0418 363 918(mobile) or (613) 9722 9167(home) > > ICQ#10658189 > Email: hypercom@c031.aone.net.au > WWW: http://www.ozemail.com.au/~hypercom > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > >
Technical Details
Message-ID:
<7prk3u$9ug$1@autumn.news.rcn.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<qfbw3.7309$O_1.50063@ozemail.com.au>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 113ae9,49e42ebcf2e23fff X-Google-Attributes: gid113ae9,public X-Google-Thread: 10d6db,49e42ebcf2e23fff X-Google-Attributes: gid10d6db,public From: "Don Vining" <don-vining@erols.com> Subject: Re: Help, newbie..question concerning character analysis of an input text string Date: 1999/08/23 Message-ID: <7prk3u$9ug$1@autumn.news.rcn.net> X-Deja-AN: 516166863 References: <qfbw3.7309$O_1.50063@ozemail.com.au> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 X-Complaints-To: abuse@rcn.com X-Trace: 5JLPRrSSUa2WUJT5bdc3o/JOCYiHExoLOC7a5gQxDFM= X-MSMail-Priority: Normal NNTP-Posting-Date: 23 Aug 1999 13:59:26 GMT Newsgroups: aus.computers.java,comp.lang.java.help