[#BloombergLP-bdlde-Utf8Util-numBytesIfValid] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlde.adoc[bdlde]::xref:BloombergLP/bdlde/Utf8Util.adoc[Utf8Util]::numBytesIfValid :relfileprefix: ../../../ :mrdocs: Return the byte length of the first `numCodePoints` encodings. == Synopsis Declared in `<bdlde_utf8util.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- static xref:BloombergLP/bdlde/Utf8Util/IntPtr.adoc[Utf8Util::IntPtr] numBytesIfValid( std::string_view const& string, xref:BloombergLP/bdlde/Utf8Util/IntPtr.adoc[IntPtr] numCodePoints); ---- == Description Return the length (in bytes) of the specified `numCodePoints` UTF‐8 encodings in the specified `string`, or a value less than 0 if `string` contains less than `numCodePoints` encodings. The behavior is undefined unless `string` refers to valid UTF‐8. Note that `string` may contain more than `numCodePoints` encodings in which case the trailing ones are ignored. DEPRECATED: Use `numBytesRaw` instead. == Return Value byte length of those encodings, or a negative value if fewer == Parameters [cols="1,4"] |=== | Name| Description | *string* | valid UTF‐8 string view to measure | *numCodePoints* | number of leading code points to measure |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#