title: Replace words in Strings
body: <p>I have a on/off button that I want to change the value of a String, if the String contains <code>randomnessOn</code> it will change to <code>randomnessOff</code> and vice versa. I can't just override the String because it doesn't only contain the value of the state of the on/off button. I have tried this code.</p>
  
  <pre><code>if(command.equals(randFor) | command.equals(randBack) | command.equals(randButton)){
          if(option.contains("randomnessOf")){
              randomness = true;
              randState = "ON";
              randStateX = 975;
              randStateY = 245;
              option = option.replace("randomnesOff", "randomnessOn");
          }
          if(option.contains("randomnessOn")){
              randomness = false;
              randState = "OFF";
              randStateX = 970;
              randStateY = 245;
              option = option.replace("randomnesOn", "randomnessOff");
          }
          loadOptions();
      }
  </code></pre>
  
  <p>It will change the text of the <code>randState</code> String and change the position of the text but it wont replace the word in the <code>option</code> String, so how would I do to replace words in the String?</p>