<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">On Wed, Feb 24, 2021 at 12:08 AM Bart via lazarus <<a href="mailto:lazarus@lists.lazarus-ide.org">lazarus@lists.lazarus-ide.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">TMask (unit masks) deals with masks with wildcards (*,? and sets of<br>
single byte chars).<br>
It is mainly used for matching filenames (similar to the Path supplied<br>
to FindFirst).<br>
<br>
TMaskEdit gives you the possibility to constrain user input to almost<br>
anything you like,<br>
Can be used for e.g. ZIP codes, only numbers etc.<br></blockquote><div><br></div><div>TMask also supports ranges and sets. See the unit test.</div><div>Eg.  '[a-b]', '[!a-b]', '[abc]', '[0-9]'<br></div><div><br></div><div>Now I found documentation for TCustomMaskEdit.EditMask. It explains the syntax and it looks like the MaskUtils syntax.</div><div>It was documented, good! I missed it earlier.</div><div>I know filename wildcards and I know regular expressions. Now learning this Mask thingy...<br></div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">As you have pointed out before, the GetCodePoint function in the Masks<br>
unit needs overhoaling.<br></blockquote><div><br></div><div>It is much worse than that!</div><div>Yes, GetCodePoint does its own nested loops and useless copies.<br></div><div>But then it and other UTF8...() functions are called inside a loop, effectively causing many nested loops.</div><div>The scalability is maybe O(n^3) or O(n^4).</div><div>José Mejuto's Mask unit looks promising. He mentioned in a private mail (which should be public IMO, no deep secrets there) that a pattern<br></div><div><i> "*something*to*write*here*"<br>"which with current mask it takes a lot of time to be processed. If matchable string is of more than 200 chars long it could take seconds to be resolved. My classes are typically O(n)."<br></i></div><div>Many seconds in a modern computer is a lot.<br></div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
(It is the same as in TMaskEdit, but that only reacts to user input<br>
with strings <=255 chars, so speed is not required there: I'ld love to<br>
see someone typing faster that the code in TMaskEdit calculates what<br>
needs to be done.)<br></blockquote><div><br></div><div>True, but the code should be cleaned anyway and maybe reuse some other code.</div><div>Code has aesthetic values, too.</div><div><br></div><div><br></div><div>Juha</div><div><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>