chsvlib
chsv helper source code

◆ ucpsnCmp()

int Chusov::String::ucpsnCmp ( const ucp_t pszStr1,
const ucp_t pszStr2,
std::size_t  count 
)
noexcept

Lexicographically compares two strings of Unicode code points with explicitly defined maximum number of characters to read and compare.

Parameters
pszStr1A zero-terminated string that is the first (left) comparand.
pszStr2A zero-terminated string that is the second (right) comparand.
countA maximum amount of characters to read and compare. Note that this is not the number of character to compare: if the zero terminator is encountered within pStr1 or pStr2, the comparison will stop whether or not count characters have been read.
Returns
A negative value, if pszStr1 is lexicographically less than pszStr2, 0, if the strings are equal, and a positive value, if pszStr1 is lexicographically greater than pszStr2.
Remarks
The function repeats the functionality of the standard strncmp function but works with ucp_t characters.