wood burning stoves*
The moose likes Beginning Java and the fly likes How do I use a (boolean?) token to reject user input? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How do I use a (boolean?) token to reject user input?" Watch "How do I use a (boolean?) token to reject user input?" New topic
Author

How do I use a (boolean?) token to reject user input?

Michael Fraczek
Greenhorn

Joined: Nov 30, 2002
Posts: 2
I have a program in which a user buys an item at a store. I have the user input the itemName, quantity, unitPrice, and whether it is taxable or not in a String which is tokenized into four parts, delimited by the "|" character.
Example: itemName|quantity|unitPrice|N
The N or n in the fourth token tells whether the purchase is taxable.
How can I use Java to reject the input and display an error message to the user if the fourth token is not input as a "n" or a "N"?
Any help is greatly appreciated!
Michael Fraczek
Greenhorn

Joined: Nov 30, 2002
Posts: 2
Here is a sample of the code I have written so far:

[ November 30, 2002: Message edited by: Marilyn de Queiroz ]
Ruben Steins
Greenhorn

Joined: Nov 22, 2002
Posts: 15

Perhaps you could use:
[QOUTE]

Tests if this string ends with the specified suffix.

of you could use:

if you're into regular expressions...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do I use a (boolean?) token to reject user input?
 
Similar Threads
passing parameters
When does Java allow console input?
Need help with Car Inventory Program part 3
urgent getting parameters
Formatting Servlet output (double precision) - Help Required.