[#BloombergLP-bdlde-Utf8Util-advanceIfValid-09] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlde.adoc[bdlde]::xref:BloombergLP/bdlde/Utf8Util.adoc[Utf8Util]::advanceIfValid :relfileprefix: ../../../ :mrdocs: Advance past 0 or more consecutive _valid_ Unicode code points at the beginning of the specified `string` having the specified `length` (in bytes), until either the specified `numCodePoints` or `length` bytes have been traversed, or invalid UTF‐8 is encountered (whichever occurs first), and return the number of Unicode code points traversed. Set the specified `*status` to 0 if no invalid UTF‐8 is encountered, and to a value from the `ErrorStatus` `enum` otherwise. Set the specified `*result` to the address of the byte immediately following the last valid code point traversed, or to `string` if `length` or `numCodePoints` is 0. `string` need not be null‐terminated and can contain embedded null bytes, and `string` may be null if `0 == length` (see {Empty Input Strings}). The behavior is undefined unless `0 <= numCodePoints`. Note that the value returned will be in the range `[0 .. numCodePoints]`. Also note that `string` may contain less than `length` Unicode code points. == Synopsis Declared in `<bdlde_utf8util.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- static xref:BloombergLP/bdlde/Utf8Util/IntPtr.adoc[IntPtr] advanceIfValid( int* status, char const** result, char const* string, xref:BloombergLP/bdlde/Utf8Util/size_type.adoc[size_type] length, xref:BloombergLP/bdlde/Utf8Util/IntPtr.adoc[IntPtr] numCodePoints); ---- [.small]#Created with https://www.mrdocs.com[MrDocs]#