title: How to check for special characters in a string using a loop
body: <p>since my prof won't let me use RegEx, I'm stuck with using loops to check each character on a string.
  Does anyone have a sample code/algorithm?</p>
  
  <pre><code>public void setAddress(string strAddress)
  {
      do
      {
          foreach (char c in Name)
          {
              if ( /*check for characters*/ == false)
              {
                  Address = strAddress;
              }
          }
          if ( /*check for characters*/ == true)
          {
              Console.Write("Invalid!");
          }
      } while ( /*check for characters*/ == true)
  }
  public int getAddress()
  {
      return Address;
  }
  </code></pre>
  
  <p>I need to only include letters and numbers. Characters such as !@#$%^&amp; are not allowed.
  I'm not allowed to use RegEx because he hasn't taught that to us yet... well I couldn't attend class on the day he taught these loops and character checking, so now he won't tell me more. ANYWAY, if there's a more efficient way without using RegEx, that'd be helpful.</p>