Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Well I know this isn't the way to properly do this, (the proper way is using regular expressions, which is what I was attempting to figure out) but if you are like me, and sick of asking/searching the same question over and over again, without getting any entirely useful feedback, this is what worked for me.</p> <pre><code> int Ucount = 0; int Lcount = 0; int Ncount = 0; foreach(char c in password) { if(c!='A' &amp;&amp; c!='B' &amp;&amp; c!='C' &amp;&amp; c!='D' &amp;&amp; c!='E' &amp;&amp; c!='F' &amp;&amp; c!='G' &amp;&amp; c!='H' &amp;&amp; c!='I' &amp;&amp; c!='J' &amp;&amp; c!='K' &amp;&amp; c!='L' &amp;&amp; c!='M' &amp;&amp; c!='N' &amp;&amp; c!='O' &amp;&amp; c!='P' &amp;&amp; c!='Q' &amp;&amp; c!='R' &amp;&amp; c!='S' &amp;&amp; c!='T' &amp;&amp; c!='U' &amp;&amp; c!='V' &amp;&amp; c!='W' &amp;&amp; c!='X' &amp;&amp; c!='Y' &amp;&amp; c!='Z') { Ucount++; if(Ucount &gt;= password.Length) { errorMessage = "Your password must contain at least one uppercase character."; } } if(c!='a' &amp;&amp; c!='b' &amp;&amp; c!='c' &amp;&amp; c!='d' &amp;&amp; c!='e' &amp;&amp; c!='f' &amp;&amp; c!='g' &amp;&amp; c!='h' &amp;&amp; c!='i' &amp;&amp; c!='j' &amp;&amp; c!='k' &amp;&amp; c!='l' &amp;&amp; c!='m' &amp;&amp; c!='n' &amp;&amp; c!='o' &amp;&amp; c!='p' &amp;&amp; c!='q' &amp;&amp; c!='r' &amp;&amp; c!='s' &amp;&amp; c!='t' &amp;&amp; c!='u' &amp;&amp; c!='v' &amp;&amp; c!='w' &amp;&amp; c!='x' &amp;&amp; c!='y' &amp;&amp; c!='z') { Lcount++; if(Lcount &gt;= password.Length) { errorMessage = "Your password must contain at least one lowercase character."; } } if(c!='0' &amp;&amp; c!='1' &amp;&amp; c!='2' &amp;&amp; c!='3' &amp;&amp; c!='4' &amp;&amp; c!='5' &amp;&amp; c!='6' &amp;&amp; c!='7' &amp;&amp; c!='8' &amp;&amp; c!='9') { Ncount++; if(Ncount &gt;= password.Length) { errorMessage = "Your password must contain at least one numerical character."; } } } </code></pre> <p>Again, please note that the proper way to do this is to use regular expressions, but this code works fine for me, and I got to end the wild goose chase that was understanding regular expressions.</p> <p>UPDATE: Or, if you want to do it right, read Branco Medeiros's post above, he posted after I posted this, and his way is the right way to do it (provided you don't want to do it with JavaScript before it is sent to the server. If your app is like mine and not resource intensive enough to need JavaScript to do this, use Branco Medeiros's example above).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload