title: Android EditText: Check if whitespace not at beginning or end
body: <p>I have an input field where the user has to enter his forename and his surname.
  Now I want to check whether there is a whitespace which is neither at the beginning nor at the end of the input. Only in this case, a button is enabled.</p>
  
  <p>Checking the whitespace is easy:</p>
  
  <pre><code>private EditText input;
  input = (EditText) findViewById(R.id.input);  
  
  if(input.getText().toString().contains(" ")) {
     button.setEnabled(true);
  }
  </code></pre>
  
  <p>But how can I make sure that the whitespace is not at the beginning or end of the input?</p>
  
  <p>Thanks for your help</p>