chsvlib
chsv helper source code

◆ ucpsnLen_s()

std:: size_t Chusov::String::ucpsnLen_s ( const ucp_t pszStr,
std::size_t  cchStr 
)
noexcept

Returns a size, in code points, of a string excluding the terminating zero, if any. The function behaves identically to the strnlen_s function of the ISO/IEC TR 24731-1 standard but is implemented for the type ucp_t.

Parameters
[in]pszStris a pointer to a string of the returned length. The parameter may be NULL, the function returns 0 in this case.
[in]cchStris a size, in code points, of the buffer where the string is located. It is treated as a maximum length of the string. Thus, the returned value is less or equal to cchStr. The parameter is ignored if pszStr is NULL.
Returns
If the pszStr pointer is NULL, the function returns 0. Otherwise, the function returns a length, in code points, of the string pointed to by pszStr. If the cchStr characters constitute a zero-terminated string the function behaves identically to ucpsLen, returning a number of code points before the null terminator. Otherwise, the function returns cchStr.
See also
ucpsLen;
strnLen_s;
wcsnLen_s.