1 // Copyright 2022 Google LLC
2 //
3 // Use of this source code is governed by an MIT-style
4 // license that can be found in the LICENSE file or at
5 // https://opensource.org/licenses/MIT.
6 
7 #ifndef THIRD_PARTY_UTF8_RANGE_UTF8_VALIDITY_H_
8 #define THIRD_PARTY_UTF8_RANGE_UTF8_VALIDITY_H_
9 
10 #include "absl/strings/string_view.h"
11 
12 namespace utf8_range {
13 
14 // Returns true if the sequence of characters is a valid UTF-8 sequence.
15 bool IsStructurallyValid(absl::string_view str);
16 
17 // Returns the length in bytes of the prefix of str that is all
18 // structurally valid UTF-8.
19 size_t SpanStructurallyValid(absl::string_view str);
20 
21 }  // namespace utf8_range
22 
23 #endif  // THIRD_PARTY_UTF8_RANGE_UTF8_VALIDITY_H_
24