Home » U++ Library support » U++ Core » PatternMatchMulti problem
Re: PatternMatchMulti problem [message #26996 is a reply to message #26994] |
Sat, 19 June 2010 14:53   |
 |
koldo
Messages: 3443 Registered: August 2008
|
Senior Veteran |
|
|
luzr wrote on Sat, 19 June 2010 11:47 |
koldo wrote on Fri, 18 June 2010 07:33 | Hello all
Now PatternMatchMulti implementation is this:
bool PatternMatchMulti(const char *p, const char *s) {
String pt;
while(*p) {
if(*p == ';' || *p == ',' || *p == ' ') {
if(PatternMatch(pt, s)) return true;
p++;
while(*p == ';' || *p == ',' || *p == ' ') p++;
pt.Clear();
}
else
pt.Cat(*p++);
}
return pt.IsEmpty() ? false : PatternMatch(pt, s);
}
It separates patterns with ';', ',' and ' '. I thing to have patterns with spaces it would be better to remove the ' ' form the function.
|
It is designed to be used with file patterns - spaces are unlikely. Especially in FileSel, using ' ' as separator is common. Changing behaviour would be break a lot of existing code.
Also, space as separator works in commandline. So perhaps, if you insist on changing behaviour, we should rather introduce "pattern with spaces" (using ").
Mirek
Mirek
|
Hello Mirek
I did not want to break anything, but it is common to have spaces in folder and file names so I think a function like PatternMatchMulti would have to consider this.
Best regards
IƱaki
[Updated on: Sat, 19 June 2010 14:53] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Wed Aug 27 08:31:04 CEST 2025
Total time taken to generate the page: 0.10179 seconds
|