• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 727
  • Last Modified:

TMask for a StringList , how?

A TMask is to determine if a string matches the format described by a mask.



But how do determine if a LIST OF STRINGS matches the format described by a mask ? any method or function available?  or i have to use iteration ???
0
jiekuan
Asked:
jiekuan
  • 2
  • 2
2 Solutions
 
kretzschmarCommented:
>or i have to use iteration ???
yes, each string of the list must be evaluated with the mask

0
 
RobnCommented:
function MaskMatches(Strings: TStrings; Mask: TMask): Boolean;
var
  i: Integer;
begin
  result := False;
  for i := 0 to Strings.Count - 1 do begin
    if not Mask.Matches(Strings[i]) then Exit;
  end;
  result := True;
end;
0
 
jiekuanAuthor Commented:
so that means Mask is only for string? not stringList
0
 
kretzschmarCommented:
>so that means Mask is only for string?
yep, robn shows, how to handle it with a stringlist
0
 
jiekuanAuthor Commented:
why
'ball?????????'

can match

'ball'  ?


 m:=TMask.Create(lowerCase('ball?????????'));

m.Matches(LowerCase(ball)) is TRUE?

why 'ball???????' can match 'ball'
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now