[#BloombergLP-bdlde-Utf8Util-numCodePointsIfValid-089] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlde.adoc[bdlde]::xref:BloombergLP/bdlde/Utf8Util.adoc[Utf8Util]::numCodePointsIfValid :relfileprefix: ../../../ :mrdocs: Return the Unicode code‐point count if `string` is valid UTF‐8. == Synopsis Declared in `<bdlde_utf8util.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- static xref:BloombergLP/bdlde/Utf8Util/IntPtr.adoc[IntPtr] numCodePointsIfValid( char const** invalidString, std::string_view const& string); ---- == Description Return the number of Unicode code points in the specified `string` if `string` contains valid UTF‐8, with no effect on the specified `invalidString`. Otherwise, return a value from the `ErrorStatus` `enum` (which are all negative) and load into `invalidString` the address of the byte after the last valid Unicode code point traversed. `string` need not be null‐terminated and may contain embedded null bytes. == Return Value code‐point count on success, or an `ErrorStatus` value == Parameters [cols="1,4"] |=== | Name| Description | *invalidString* | if non‐null, set to after the last valid code point | *string* | UTF‐8 string view to examine |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#