Which option is faster...

dennis luehring dl.soluz at gmx.net
Mon Aug 5 07:27:41 PDT 2013


did you benchmarked your current szenario - how do you know that this is 
the slow part - or are you working on an only-extension-compare-tool?

btw: they are both equal and slow - and full of partly code-duplication
std.string.tolower(fext[0]) multiple times, i hope your list isn't going 
much longer

Am 05.08.2013 15:59, schrieb jicman:
>
> Greetings!
>
> I have this code,
>
> foreach (...)
> {
>
>     if (std.string.tolower(fext[0]) == "doc" ||
>       std.string.tolower(fext[0]) == "docx" ||
>       std.string.tolower(fext[0]) == "xls" ||
>       std.string.tolower(fext[0]) == "xlsx" ||
>       std.string.tolower(fext[0]) == "ppt" ||
>       std.string.tolower(fext[0]) == "pptx")
>      continue;
> }
>
> foreach (...)
> {
>     if (std.string.tolower(fext[0]) == "doc")
>       continue;
>     if (std.string.tolower(fext[0]) == "docx")
>       continue;
>     if (std.string.tolower(fext[0]) == "xls")
>       continue;
>     if (std.string.tolower(fext[0]) == "xlsx")
>       continue;
>     if (std.string.tolower(fext[0]) == "ppt")
>       continue;
>     if (std.string.tolower(fext[0]) == "pptx")
>      continue;
>     ...
>     ...
> }
>
> thanks.
>
> josé
>



More information about the Digitalmars-d-learn mailing list