Qstrcmp: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
Fox (talk | contribs)
Created page with "'''qstrcmp''' <quote1> <quote2> <var> Compare two quotes. <var> returns zero if they are identical, -1 if the first quote comes first in alphabetical order, 1 if it comes lat..."
 
Correct the documentation. The return value is not guaranteed to be 1 and -1 if non-equal.
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
'''qstrcmp''' <quote1> <quote2> <var>
'''qstrcmp''' <quote1> <quote2> <return>


Compare two quotes. <var> returns zero if they are identical, -1 if the first quote comes first in alphabetical order, 1 if it comes later.
Compare two quotes. The return value is zero if they are identical, smaller than zero if the first quote comes first in lexicographical order, or greater than zero if it comes later.


Note that the lexicographical order is rudimentary, for example "Player 2" is considered greater than "Player 10".
Note that the return value is taken directly from the <code>strcmp</code> function of the [https://en.cppreference.com/w/c/string/byte/strcmp C standard library], and may differ between implementations (e.g. on Windows and Linux). Do not assume that it will return any specific value, only that it is smaller, greater or equal to zero.
 
Also note that the lexicographical order is rudimentary, for example "Player 2" is considered greater than "Player 10".
 
[[Category:EDuke32 specific commands]]
[[Category:String manipulation]]

Latest revision as of 12:54, 28 May 2024

qstrcmp <quote1> <quote2> <return>

Compare two quotes. The return value is zero if they are identical, smaller than zero if the first quote comes first in lexicographical order, or greater than zero if it comes later.

Note that the return value is taken directly from the strcmp function of the C standard library, and may differ between implementations (e.g. on Windows and Linux). Do not assume that it will return any specific value, only that it is smaller, greater or equal to zero.

Also note that the lexicographical order is rudimentary, for example "Player 2" is considered greater than "Player 10".