Home How would I use the result of a variable as a variable rather than plain text
Reply: 0

How would I use the result of a variable as a variable rather than plain text

user766
1#
user766 Published in July 19, 2018, 9:58 am

The problem I have is "slowRotor" returns the value "Rotor_I".

I would like to use the result of slowRotor (Rotor_I) as the variable Rotor_I and not the "plain text" so to speak.

I'm wondering if that is possible in Java and if so, how it would be done (As i'm trying to avoid lots of if statements)

    String slowRotor = GUI.getRotorInPosition("slow");
    int position = (alphabet.indexOf(result));
    String resultAfterRotor = "";
    if (Rotor == "Slow") {          
        resultAfterRotor = Character.toString((slowRotor.charAt(position))); 
    }

And

static String alphabet ="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
static String Rotor_I = "EKMFLGDQVZNTOWYHXUSPAIBRCJ";   
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.423041 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO