A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
The Mikado Method
this week in the
Agile and other Processes
forum!
JavaRanch
»
Java Forums
»
Java
»
Game Development
Author
Variable name from a string
Tim Porritt
Greenhorn
Joined: Jul 22, 2012
Posts: 4
posted
Jul 22, 2012 05:04:46
0
Hi i'm not sure if this is possible or not, but i want to get a variable name from a
string
.
My code so far is as follows:
String[] alphabet = {"A", "B", "C", "D", "E"}; private int keycode(String i) { for(int a = 0; a < alphabet.length; a++) { if(i.equals(alphabet[a])) { String vk = "KeyEvent.VK_" + alphabet[a]; return vk; } } }
I'll add the rest of the alphabet later.
Thanks in advance for any help given.
fred rosenberger
lowercase baba
Bartender
Joined: Oct 02, 2003
Posts: 9955
6
I like...
posted
Jul 22, 2012 07:13:25
0
closing duplicate post
Never ascribe to malice that which can be adequately explained by stupidity.
I agree. Here's the link:
http://ej-technologies/jprofiler
- if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
subject: Variable name from a string
Similar Threads
Caesar cipher
Add a letter to the end of a variable name
NoSuchMethodError
A contradiction....(Kahlid Mughal & Sun Java Tutorial)
Programming Diversion 2a: Applying a Key
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter