upper_bound_string.h 773 B

123456789101112131415161718192021
  1. // Copyright 2022 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_DATABASE_UTILS_UPPER_BOUND_STRING_H_
  5. #define COMPONENTS_DATABASE_UTILS_UPPER_BOUND_STRING_H_
  6. #include <string>
  7. namespace database_utils {
  8. // Returns a string with the following property:
  9. // Condition (str >= prefix AND str < UpperBoundString(prefix))
  10. // is satisfied for all strs that start with prefix and only for them.
  11. // This can be used for optimization purposes to avoid using the LIKE operator.
  12. // prefix must be a UTF-8 string.
  13. std::string UpperBoundString(const std::string& prefix);
  14. } // namespace database_utils
  15. #endif // COMPONENTS_DATABASE_UTILS_UPPER_BOUND_STRING_H_