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.filenameCharCmp
Compares filename characters.
This function can perform a
case-sensitive or a
case-insensitive
comparison. This is controlled through the cs
template parameter
which, if not specified, is given by CaseSensitive
.osDefault
.
On Windows, the backslash and slash characters (
and \
)
are considered equal.
/
Prototype
int filenameCharCmp(std.path.CaseSensitive cs)( dchar a, dchar b ) pure nothrow @safe;
Parameters
Name | Description |
---|---|
cs | Case-sensitivity of the comparison. |
a | A filename character. |
b | A filename character. |
Returns
Examples
assert (filenameCharCmp('a', 'a') == 0); assert (filenameCharCmp('a', 'b') < 0); assert (filenameCharCmp('b', 'a') > 0); version (linux) { // Same as calling filenameCharCmp!(CaseSensitive.yes)(a, b) assert (filenameCharCmp('A', 'a') < 0); assert (filenameCharCmp('a', 'A') > 0); } version (Windows) { // Same as calling filenameCharCmp!(CaseSensitive.no)(a, b) assert (filenameCharCmp('a', 'A') == 0); assert (filenameCharCmp('a', 'B') < 0); assert (filenameCharCmp('A', 'b') < 0); }
Authors
Lars Tandle Kyllingstad, Walter Bright, Grzegorz Adam Hankiewicz, Thomas Kühne, Andrei Alexandrescu