type.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #pragma once
  2. #include <util/generic/strbuf.h>
  3. Y_PURE_FUNCTION bool IsSpace(const char* s, size_t len) noexcept;
  4. /// Checks if a string is a set of only space symbols.
  5. Y_PURE_FUNCTION static inline bool IsSpace(const TStringBuf s) noexcept {
  6. return IsSpace(s.data(), s.size());
  7. }
  8. /// Returns "true" if the given string is an arabic number ([0-9]+)
  9. Y_PURE_FUNCTION bool IsNumber(const TStringBuf s) noexcept;
  10. Y_PURE_FUNCTION bool IsNumber(const TWtringBuf s) noexcept;
  11. /// Returns "true" if the given string is a hex number ([0-9a-fA-F]+)
  12. Y_PURE_FUNCTION bool IsHexNumber(const TStringBuf s) noexcept;
  13. Y_PURE_FUNCTION bool IsHexNumber(const TWtringBuf s) noexcept;
  14. /* Tests if the given string is case insensitive equal to one of:
  15. * - "true",
  16. * - "t",
  17. * - "yes",
  18. * - "y",
  19. * - "on",
  20. * - "1",
  21. * - "da".
  22. */
  23. Y_PURE_FUNCTION bool IsTrue(const TStringBuf value) noexcept;
  24. /* Tests if the given string is case insensitive equal to one of:
  25. * - "false",
  26. * - "f",
  27. * - "no",
  28. * - "n",
  29. * - "off",
  30. * - "0",
  31. * - "net".
  32. */
  33. Y_PURE_FUNCTION bool IsFalse(const TStringBuf value) noexcept;