File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Converting user inputs to enum constants Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Converting user inputs to enum constants" Watch "Converting user inputs to enum constants" New topic
Author

Converting user inputs to enum constants

Mike Chen
Greenhorn

Joined: Jul 05, 2010
Posts: 5
Hi everyone,

I am creating a dictionary/vocab program and having users input the word, the definition, and the part of speech, but I would like the part of speech to be an enum constant. I have a PartOfSpeech enum with the NOUN, VERB, ADJECTIVE, and ADVERB values, and would like to have the user input the part of speech as an abbreviation (n/v/adj/adv). What is the best way to take the user input as an abbreviation and convert that into an enum constant? Thanks.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

Map


luck, db
There are no new questions, but there may be new answers.
 
Don't get me started about those stupid light bulbs.
 
subject: Converting user inputs to enum constants
 
Similar Threads
playing ogg voices as smooth as possible in java TTS
Serialize/Deserialize Java enum
Typo in Mcgraw-Hill SCJP 5 Book?
Oracle equivalent of MySQLs "enum"?
Strange Enum behaviour?