View source code
Display the source code in std/path.d from which this page was generated on
github.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Page wiki
View or edit the community-maintained wiki page associated with this page.
Function std.path.filenameCmp
Compares file names and returns
Individual characters are compared using
,
where filenameCharCmp
!cscs
is an optional template parameter determining whether
the comparison is case sensitive or not.
Treatment of invalid UTF encodings is implementation defined.
Prototype
int filenameCmp(std.path.CaseSensitive cs, Range1, Range2)( Range1 filename1, Range2 filename2 ) if (isInputRange!Range1 && isSomeChar!(ElementEncodingType!Range1) && isInputRange!Range2 && isSomeChar!(ElementEncodingType!Range2));
Parameters
Name | Description |
---|---|
cs | case sensitivity |
filename1 | range for first file name |
filename2 | range for second file name |
Returns
< 0
if
,
filename1
< filename2
0
if
and
filename1
== filename2
> 0
if
.
filename1
> filename2
See Also
Examples
assert (filenameCmp("abc", "abc") == 0); assert (filenameCmp("abc", "abd") < 0); assert (filenameCmp("abc", "abb") > 0); assert (filenameCmp("abc", "abcd") < 0); assert (filenameCmp("abcd", "abc") > 0); version (linux) { // Same as calling filenameCmp!(CaseSensitive.yes)(filename1, filename2) assert (filenameCmp("Abc", "abc") < 0); assert (filenameCmp("abc", "Abc") > 0); } version (Windows) { // Same as calling filenameCmp!(CaseSensitive.no)(filename1, filename2) assert (filenameCmp("Abc", "abc") == 0); assert (filenameCmp("abc", "Abc") == 0); assert (filenameCmp("Abc", "abD") < 0); assert (filenameCmp("abc", "AbB") > 0); }
Authors
Lars Tandle Kyllingstad, Walter Bright, Grzegorz Adam Hankiewicz, Thomas Kühne, Andrei Alexandrescu