Thread View: aus.computers.java
3 messages
3 total messages
Started by Michael Little
Mon, 23 Aug 1999 00:00
Help, newbie..question concerning character analysis of an input text string
Author: Michael Little
Date: Mon, 23 Aug 1999 00:00
Date: Mon, 23 Aug 1999 00:00
44 lines
2213 bytes
2213 bytes
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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Re: Help, newbie..question concerning character analysis of an input text string
Author: 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 > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > >
Re: Help, newbie..question concerning character analysis of an input text string
Author: VrLife
Date: Wed, 01 Sep 1999 00:00
Date: Wed, 01 Sep 1999 00:00
29 lines
2125 bytes
2125 bytes
you should try looking into StringTokenizer from java.util.StringTokenizer vin On Mon, 23 Aug 1999 22:41:04 +1000, "Michael Little" <hypercom@c031.aone.net.au> wrote: >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!
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads