string.hpp 859 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. //
  2. // Copyright (c) 2022-2023 Alexander Grund
  3. //
  4. // Distributed under the Boost Software License, Version 1.0.
  5. // https://www.boost.org/LICENSE_1_0.txt
  6. #ifndef BOOST_LOCALE_UTIL_STRING_HPP
  7. #define BOOST_LOCALE_UTIL_STRING_HPP
  8. #include <boost/locale/config.hpp>
  9. namespace boost { namespace locale { namespace util {
  10. /// Return the end of a C-string, i.e. the pointer to the trailing NULL byte
  11. template<typename Char>
  12. Char* str_end(Char* str)
  13. {
  14. while(*str)
  15. ++str;
  16. return str;
  17. }
  18. inline bool is_upper_ascii(const char c)
  19. {
  20. return 'A' <= c && c <= 'Z';
  21. }
  22. inline bool is_lower_ascii(const char c)
  23. {
  24. return 'a' <= c && c <= 'z';
  25. }
  26. inline bool is_numeric_ascii(const char c)
  27. {
  28. return '0' <= c && c <= '9';
  29. }
  30. }}} // namespace boost::locale::util
  31. #endif