Einzelnen Beitrag anzeigen

Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
43.116 Beiträge
 
Delphi 12 Athens
 
#17

Re: Stringvergleich mit Wildcards

  Alt 7. Mai 2009, 10:17
nee, ist hier nicht drin
[add]
(jetzt weiß ich wieder wofür die goElse-Sprungmarke war, welche nun sinnlos im code rumlag )
ich kann's ja wieder einbauen
[/add]


zum [edit] ups muß ich mal sehn

hab mir zwar 'ne Testreihe aufgebaut und das MatchText('a?def','abcdef') lieferte eigentlich ein richtiges Ergebnis
(allerdings muß ich zugeben, daß ich nur die UnicodeVersion getestet hab ... vielleicht hab ich ja nur bei der Umstellung 'nen Fehler gemacht )
Delphi-Quellcode:
If MatchText('', 'abcdef') Then Beep;
If MatchText('def', '') Then Beep;
If not MatchText('abcdef', 'abcdef') Then Beep;
If MatchText('df', 'abcdef') Then Beep;
If MatchText('abc', 'abcdef') Then Beep;
If MatchText('def', 'abcdef') Then Beep;
If MatchText('abc?f', 'abcdef') Then Beep;
If not MatchText('abc??f', 'abcdef') Then Beep;
If not MatchText('abc*f', 'abcdef') Then Beep;
If MatchText('a?def', 'abcdef') Then Beep;
If not MatchText('a??def', 'abcdef') Then Beep;
If not MatchText('a*def', 'abcdef') Then Beep;
If MatchText('abcd?', 'abcdef') Then Beep;
If not MatchText('abcd??', 'abcdef') Then Beep;
If MatchText('abcd???', 'abcdef') Then Beep;
If not MatchText('abcd*', 'abcdef') Then Beep;
If MatchText('a?def', 'abcdef') Then Beep;
If not MatchText('a??def', 'abcdef') Then Beep;
If not MatchText('a*def', 'abcdef') Then Beep;
If MatchText('?cdef', 'abcdef') Then Beep;
If not MatchText('??cdef', 'abcdef') Then Beep;
If not MatchText('*cdef', 'abcdef') Then Beep;
If MatchText('b*c*f', 'abcdef') Then Beep;
If not MatchText('a*c*f', 'abcdef') Then Beep;
If not MatchText('a?c*f', 'abcdef') Then Beep;
If MatchText('a?d*f', 'abcdef') Then Beep;
If not MatchText('*a*f*', 'abcdef') Then Beep;
If MatchText('*a?bf*', 'abcdef') Then Beep;
If not MatchText('*c*f*', 'abcdef') Then Beep;
If not MatchText('*c*d*', 'abcdef') Then Beep;
If MatchText('*c?f*', 'abcdef') Then Beep;
If not MatchText('*d?f*', 'abcdef') Then Beep;
If not MatchText('*', '') Then Beep;
If not MatchText('*', 'abcdef') Then Beep;
If not MatchText('a*', 'abcdef') Then Beep;
If not MatchText('*f', 'abcdef') Then Beep;

If not MultiMatchText('a*d|a*', 'abcdef') Then Beep;
Garbage Collector ... Delphianer erzeugen keinen Müll, also brauchen sie auch keinen Müllsucher.
my Delphi wish list : BugReports/FeatureRequests
  Mit Zitat antworten Zitat