Return whether a bounded string contains valid UTF‐8.

Synopsis

Declared in <bdlde_utf8util.h>

static
bool
isValid(
    char const** invalidString,
    char const* string,
    size_type length);

Description

Return true if the specified string having the specified length (in bytes) contains valid UTF‐8, and false otherwise. If string contains invalid UTF‐8, load into the specified invalidString the address of the byte after the last valid code point traversed; invalidString is unaffected if string contains only valid UTF‐8. string need not be null‐terminated and can contain embedded null bytes, and string may be null if 0 == length (see {Empty Input Strings}).

Return Value

true if string is valid UTF‐8, and false otherwise

Parameters

Name

Description

invalidString

if non‐null, set to after the last valid code point

string

UTF‐8 byte sequence (need not be null‐terminated)

length

length of string in bytes

Created with MrDocs