title: How to ignore spaces between text editview Android
body: <p>I am trying to ignore spaces in editview between text, I am not quite sure how I can go about doing this. I know I can use trim feature to ignore spaces before and after the full text but how do I ignore space between strings if there is any;</p>
  
  <pre><code>String myTextEdited myText.getText().toString().trim();
  </code></pre>
  
  <p>For example, if I have / user types in this;</p>
  
  <pre><code>Allan Bob
  3523 JKO
  NY1 U90
  </code></pre>
  
  <p>I want to ingore spaces when I read this in my if statement or put it in another variable for example;</p>
  
  <p>String name = "AllanBob"</p>
  
  <p>For example, to ignore upper and lower cases I am doing this;</p>
  
  <pre><code> if (myText.getText().toString().trim().equalsIgnoreCase(userInput)) {
                      // do something
                  } else {
                      // do something
                  }
  </code></pre>
  
  <p>What I would like to do is add another feature in here that also ignores spaces before, between and after text e.g. instead of;</p>
  
  <pre><code>   myname   is Henry      .   (space until here)
  </code></pre>
  
  <p>It should read it as mynameishenry but to the user it still appears as they have written it.</p>
  
  <p>Please let me know if my question was not clear, I will try explaining it better</p>
  
  <p>EDITED:</p>
  
  <p>is it possible to ignore spaces in string that I have inside my if statement. For example;</p>
  
  <pre><code>if (myText.getText().toString().trim().equalsIgnoreCase("Henry 0887")) {
                      // do something
                  } else {
                      // do something
                  }
  </code></pre>
  
  <p>but currently if the user types in henry0887, the if statement does not validate it because I added a space inside my validation text and therefoe its looking for a space in the text, is it possible to over come this, so even if I have space inside my validation it ignores it.</p>