On Thursday, 9 January 2014 at 18:53:58 UTC, Martin Nowak wrote:
Neither this
if (path.baseName.startsWith(something))
doThis();
nor this
if (startsWith(baseName(path), something))
doThis();
but a combination of the two
if (baseName(path).startsWith(something))
doThis();
make it possible to write readable sentences.
-Martin
...is that a question?
I find the first is most readable. Well, (IMO) with added parens
too:
if (path.baseName().startsWith(something))
doThis();
The "standard" one:
startsWith(baseName(path), something)
looks just plain horrible (IMO).
The last one looks... intermediate.