<div dir="ltr">Oops...<div class="gmail_extra"><br><div class="gmail_quote">2014-03-12 15:08 GMT-03:00 silvioprog <span dir="ltr"><<a href="mailto:silvioprog@gmail.com" target="_blank">silvioprog@gmail.com</a>></span>:</div>
<div class="gmail_quote">[...]<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra">
<div class="gmail_quote"><div><div>// new</div><div><div>function ValidPassword(const S: string): Boolean;</div><div>var</div><div> P: PChar;</div><div> F: Boolean;</div><div> L: Boolean = False;</div><div> U: Boolean = False;</div>
<div> N: Boolean = False;</div><div>begin</div><div> P := PChar(S);</div><div> while P^ <> #0 do</div><div> begin</div><div> case P^ of</div><div> #48..#57: N := True;</div><div> #65..#90: U := True;</div>
<div> #97..#122: L := True;</div><div> else</div><div> F := P^ = #195;</div><div> if F then</div><div> case P[1] of</div><div> #128..#159: U := True;</div><div> #160..#191: L := True;</div>
<div> end;</div><div> end;</div><div> Inc(P);</div><div> end;</div><div> Result := L and U and N;</div><div>end;</div></div></div></div></div></div></blockquote><div><br></div><div>Correct function is:</div>
<div><br></div><div><div>function ValidPassword(const S: string): Boolean;</div><div>var</div><div> P: PChar;</div><div> L: Boolean = False;</div><div> U: Boolean = False;</div><div> N: Boolean = False;</div><div>begin</div>
<div> P := PChar(S);</div><div> while P^ <> #0 do</div><div> begin</div><div> case P^ of</div><div> #48..#57: N := True;</div><div> #65..#90: U := True;</div><div> #97..#122: L := True;</div><div>
else</div><div> if P^ = #195 then</div><div> case P[1] of</div><div> #128..#159: U := True;</div><div> #160..#191: L := True;</div><div> end;</div><div> end;</div><div> Inc(P);</div>
<div> end;</div><div> Result := L and U and N;</div><div>end;</div></div><div><br></div><div>-- </div></div>Silvio Clécio<br>My public projects - <a href="http://github.com/silvioprog" target="_blank">github.com/silvioprog</a>
</div></div>