View source code
Display the source code in dmd/expression.d from which this
page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a
Bugzilla issue.
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.
Function dmd.expression.StringExp.compare
Compare two StringExp
by length, then value
The comparison is not the usual C-style comparison as seen with
strcmp
or memcmp
, but instead first compare based on the length.
This allows both faster lookup and sorting when comparing sparse data.
This ordering scheme is relied on by the string-switching feature.
Code in Druntime's core
relies on this ordering
when doing a binary search among case statements.
Both StringExp
should be of the same encoding.
Parameters
Name | Description |
---|---|
se2 | String expression to compare this to |
Returns
0
when this
is equal to se2, a value greater than 0
if
this
should be considered greater than se2
,
and a value less than 0
if this
is lesser than se2
.
Authors
License
Copyright © 1999-2024 by the D Language Foundation | Page generated by ddox.