Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Method to find reserved words

 
Tom Diamond
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
Is there a method in the Java API that indicates wether a string given as parameter is a reserved word or not? (reserved word aka 'public', 'void', etc.).
Tnx,
Tom.
 
omar khan
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not think it exists.
Never heard of.
Anyway to write one should be straightforward.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with Omar. The HashSet class seems ideal for this. Here's a list of keywords for you.
 
Steve Loughran
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code to do this is in apache tomcat and then in ant; it is there to rename JSP pages.

the code to compare this is simply

for performance, a hash table would be better.
-steve
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic