Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-09 09:30:24

0001 // Copyright 2022 Google LLC
0002 //
0003 // Use of this source code is governed by an MIT-style
0004 // license that can be found in the LICENSE file or at
0005 // https://opensource.org/licenses/MIT.
0006 
0007 #ifndef THIRD_PARTY_UTF8_RANGE_UTF8_VALIDITY_H_
0008 #define THIRD_PARTY_UTF8_RANGE_UTF8_VALIDITY_H_
0009 
0010 #include <cstddef>
0011 
0012 #include "absl/strings/string_view.h"
0013 #include "utf8_range.h"
0014 
0015 namespace utf8_range {
0016 
0017 // Returns true if the sequence of characters is a valid UTF-8 sequence.
0018 inline bool IsStructurallyValid(absl::string_view str) {
0019   return utf8_range_IsValid(str.data(), str.size());
0020 }
0021 
0022 // Returns the length in bytes of the prefix of str that is all
0023 // structurally valid UTF-8.
0024 inline size_t SpanStructurallyValid(absl::string_view str) {
0025   return utf8_range_ValidPrefix(str.data(), str.size());
0026 }
0027 
0028 }  // namespace utf8_range
0029 
0030 #endif  // THIRD_PARTY_UTF8_RANGE_UTF8_VALIDITY_H_